How to change clock on site

Script on site, is saying expired


How can i change the time on the site up until Thursday it was a countdown timer for a week, i was wondering how do i change it here on
Jonathan DuaneAsked:
Who is Participating?
gr8gonzoConnect With a Mentor ConsultantCommented:
Here's the code that sets the "target" date/time:
// Set the date we're counting down to
var countDownDate = new Date("May 10, 2018 23:59:25").getTime();

Open in new window

Oh, and it's worth mentioning that you don't have a timezone specified, which means that people in different time zones will see a countdown timer based on their time zone. In other words, if someone in the Pacific timezone and someone in the Eastern timezone both go and hit the page at the same time, the person in Pacific will have an extra 3 hours on his/her countdown compared to the person in the Eastern timezone.

Or if the person in Eastern sees the EXPIRED message, he could change his system clock to another timezone or another time and it would give him more time.

If you want the timer to actually be consistent, then you might need the server to calculate how much time is left and then let Javascript just count down from that point.
Julian HansenConnect With a Mentor Commented:
Following on from Gr8gonzo's post

Specify your time in UTC format.

So, if you are on East Coast Time (US) for instance and you want your countdown to stop at 23:59:25 in your locale then you would need to add 5 hours to your expire time

var countDownDate = new Date(Date.UTC(2018, 04, 11, 04, 59, 25));

Open in new window

Now it should not matter what time zone your visitors are in they should see a consistent countdown timer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.