
newDate(Date.now()).toLocaleTimeString("en-US",{timeZone:"America/Chicago",})The above code outputssomething like:4:30:05 PM.
For me, this comes in handy when running a Node server that is being watched by something likenodemon. In this way, I can see 👀 the timings and know that things are updating properly as I save my code.
Note that if you want the entire date included, just use:toLocaleString instead oftoLocaleTimeString 👆🏾.
Finally, you cansee 👀 the list here to get the correct TZstrings such as"America/Chicago".
Top comments(3)

- Location62236
- EducationBS - Mech. Eng. - Missouri S&T
- Joined
That works too...not really sure what would be the benefit.

developer.mozilla.org/en-US/docs/W...
Intl is the new optimized API where Date objects starts to be a little obsolete.
For further actions, you may consider blocking this person and/orreporting abuse



