How to Display Dates and Times in JavaScript - Beginner's Tutorial

  Рет қаралды 17,518

dcode

dcode

Күн бұрын

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

Пікірлер: 26
@hunnidbands100
@hunnidbands100 3 жыл бұрын
thank you for padstart didnt know bout this method
@dcode-software
@dcode-software 3 жыл бұрын
No worries!
@RaviTeja-ec7mf
@RaviTeja-ec7mf 3 жыл бұрын
I learned something new in this video Great job 👍
@widespectrumcreators4691
@widespectrumcreators4691 9 ай бұрын
You rock man! 👍👍🤩🤩
@noctxrnyl8240
@noctxrnyl8240 Жыл бұрын
v informative
@woestyn202
@woestyn202 9 ай бұрын
thank you so much for this video. "dcode" you Rock man!
@dcode-software
@dcode-software 9 ай бұрын
Glad it was helpful!
@jacob-w
@jacob-w 3 жыл бұрын
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.
@dcode-software
@dcode-software 3 жыл бұрын
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.
@jacob-w
@jacob-w 3 жыл бұрын
@@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.
@romuloalves9349
@romuloalves9349 3 жыл бұрын
Ótimo vídeo parabéns 👍.
@dbd868
@dbd868 3 жыл бұрын
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....
@yudhweersingh
@yudhweersingh 3 жыл бұрын
A lot of learning for me, Thanks for making such a great video. And your English accent is very clear easy to understand.
@isaacrivera5452
@isaacrivera5452 2 жыл бұрын
thank you you explained everything, some other video does the code without even showing how and why it does what.
@israelochoab3113
@israelochoab3113 3 жыл бұрын
And what about Intl.DateTimeFormat?
@sudeepkumar8844
@sudeepkumar8844 3 жыл бұрын
Sir please make tutorial on web push notifications complete.
@tuannguyenanh3178
@tuannguyenanh3178 3 жыл бұрын
Thanks a lot - just what I am looking for.
@mrcash1309
@mrcash1309 3 жыл бұрын
This is really nice. Thank you :)
@mahmudulhasan6355
@mahmudulhasan6355 2 жыл бұрын
nice one!!!! thanks a lot!!!!
@jamesmassa1999
@jamesmassa1999 3 жыл бұрын
Dom liked this vid! Your coding is intuitive. : ) : ) Thank you for your time and effort!
@dcode-software
@dcode-software 3 жыл бұрын
Glad it was helpful!
@mounir101
@mounir101 3 жыл бұрын
Pretty awesome!
@rangabharath4253
@rangabharath4253 3 жыл бұрын
awesome
@mallusrgreat
@mallusrgreat 3 жыл бұрын
Why do you have low views
@dcode-software
@dcode-software 3 жыл бұрын
😥
@Knorway56
@Knorway56 3 жыл бұрын
👍
#16 How to use the JS Date object | JavaScript Full Tutorial
15:36
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 18 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,7 МЛН
ОТОМСТИЛ МАМЕ ЗА ЧИПСЫ🤯#shorts
00:44
INNA SERG
Рет қаралды 4,8 МЛН
Coding A Calendar App In Plain JavaScript
1:03:46
PortEXE
Рет қаралды 83 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
Learn JavaScript DOM Traversal In 15 Minutes
14:44
Web Dev Simplified
Рет қаралды 225 М.
The Problem with Time & Timezones - Computerphile
10:13
Computerphile
Рет қаралды 4 МЛН
How to Use JSON - JavaScript Tutorial
8:02
dcode
Рет қаралды 70 М.
How to Format Dates with Vanilla JavaScript
10:51
Coding in Public
Рет қаралды 7 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
JavaScript "this" Keyword Explained
7:55
dcode
Рет қаралды 12 М.
Intl API and Localizing Date and Time | Intl API | JavaScript
13:19
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 18 МЛН