How to Add Local Time to Website

So I am trying to add a local time clock to my website.

I have the custom code embedded and everything is working fine EXCEPT the time I set to for EST is actually 5 hours behind the real EST time.

#localTime { font-family: system-ui; font-size: 14px; color: white; text-align: center; }

hi @CodeBrah as you do not follow form post guide it will be hard for someone to suggest why your code doesn’t work. My crystal ball suggest similtar code in your project.

const date = new Date();
// Results below assume UTC timezone - your results may vary

// Specify default date formatting for language (locale)
console.log(new Intl.DateTimeFormat('en-US').format(date));
// Expected output: "12/20/2020"

// Specify date and time format using "style" options (i.e. full, long, medium, short)
  new Intl.DateTimeFormat('en-US', {
    dateStyle: 'full',
    timeStyle: 'long',
    timeZone: 'EST',

and as this works I can’t suggest why it doesn’t for you.

1 Like

Adding to Stan’s comments, EST is UTC-5.
So the obvious conclusion is that the date you’re showing is actually UTC, not EST.

That would account for the 5 hours difference.