How to Display Dates and Times in JavaScript - Beginner's Tutorial
Вставка
- Опубліковано 12 вер 2024
- In today's video I'll be showing you how to display/format dates and times in JavaScript. I'll be showing two examples: plain JavaScript and using a library like Day.js
Day.js Library:
day.js.org/doc...
For your reference, check this out:
www.w3schools....
💜 Join my Discord Server:
/ discord
Support me on Patreon:
/ dcode
Follow me on Twitter:
@dcodeyt
If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
#dcode
A lot of learning for me, Thanks for making such a great video. And your English accent is very clear easy to understand.
thank you for padstart didnt know bout this method
No worries!
thank you so much for this video. "dcode" you Rock man!
Glad it was helpful!
I learned something new in this video
Great job 👍
thank you you explained everything, some other video does the code without even showing how and why it does what.
Dom liked this vid! Your coding is intuitive. : ) : ) Thank you for your time and effort!
Glad it was helpful!
You rock man! 👍👍🤩🤩
Vanilla Javascript has Intl.DateTimeFormat() functions, so you don't usually need to build simple or standard data formats by hand or use external libraries. Check MDN for documentation. Just Google: "Intl.DateTimeFormat" and you'll get the docs. :) Browser compatibility is no issue.
Thanks, yeah you can use that method if it works for you but it doesn't let you pass in a mask to get custom formatting.
@@dcode-software You can always use Intl.DateTimeFormat.prototype.formatToParts() and get an array that holds every single part of a datetime, if you want something non-standard and/or custom formats. It's locale aware, so you don't even have to translate your months and days! :-)
But sure, you cant't pass a format to that directly, but that's almost the point oft Intl.DateTimeFormat - you usually don't have to and you don't have to know how dates are formatted internationally.
Anyway I do like your videos and this is not a criticizm. Just a suggestion that there is a "standard way" of doing things too.
As a non-native english speaker those Intl functions are close to my heart. :-D Intl.NumberFormat() and Intl.RelativeTimeFormat() are worth checking out too.
Thanks a lot - just what I am looking for.
nice one!!!! thanks a lot!!!!
This is really nice. Thank you :)
v informative
Pretty awesome!
Ótimo vídeo parabéns 👍.
Sir please make tutorial on web push notifications complete.
how to add say, "5 days 3 hours 2 minutes to that code so that i could get the time to finished a certain production....help me out...thanks for this its really great....
And what about Intl.DateTimeFormat?
awesome
👍
Why do you have low views
😥