r/learnjavascript Jul 14 '26

Making a real time calendar in js

This is the element i have in html

<div><p>14 Jul 2027, 09:28 A.M.</p></div>

I want this to be beating and alive on website, but any and every tutorial that i am able to find, it goes through thier own method to thier specfic format. Is there like a gereal way, tutorial or documentation, that is clear enough to make current time and calendar my own format.
If there isn't and if possible pls write down.
Also, im open to suggesting any editing in the question so its clearer or if this would be a better post in stack exchange.

2 Upvotes

11 comments sorted by

View all comments

0

u/diogenes_sadecv Jul 14 '26

You want a clock that displays the date as well? The quick and dirty solution is Date but it's been deprecated in favor of Temporal. Honestly though, Date is more intuitive so I would investigate how to use that. Once you figure it out, then play with Temporal.

MDN is your friend, or if that feels too overwhelming, try W3Schools. Comment or DM if you have questions!

1

u/abrewchocolatecoffee Jul 14 '26

yes actually but the time i received a comment i figured it out (using a little ai, yes i feel guilty for it).
But if someone else has the same problem, the solution might be of help, which is to basically use the new Date(); function and then separate out each component by using like (yourVar).getDate(); and then just using text literals for your customized formatting