Closed saeedhei closed 7 years ago
new Date(2017, 11, 2) => 2017-12-02
I'm Getting Syntax Error Can you edit my Example please and write full code and set to tommorow I mean today is 01.11.2017 and tommorow is 02.11.2017
/////////////////////////////////
var aaa = countdown(new Date(2017-11-2)).toString();
output
47 years, 10 months, 2 hours, 42 minutes and 31 seconds
/////////////////////////////////
var aaa = countdown(new Date(2018, 11, 1), null, countdown.DAYS)
console.log(aaa)
days: 395
why 395?
Months are zero based in the Date constructor. So:
const countdown = require('countdown'); var aaa = countdown( new Date(2017, 10, 2) ).toString(); console.log(aaa)
And for example I have a meet with my 2 friends in tommorow in my local time zone, And I set countdown for 24 hours later, but if someone be ahead of my local zone and someone behind of my local zone, then how should I solve this problem?
Unfortunately, time zones are poorly supported in JavaScript. You basically can either work in UTC or the viewer’s browser local time zone. Not much else exists.
The countdown.js readme has a callout box that discusses time zones and how they relate to this.
The short answer is if you are talking about a specific point in time, use the milliseconds constructor to establish specific point in UTC time. If you are talking about a relative date (example New Year’s Day when the year changes), then specify with new Date(yyyy, M, d, H, m, s).
Thank you
How to Set a Countdown in Node.js with time zone?
I need: begin at noon Eastern Standard Time on Wednesday November 22, 2017
today is 2017.11.01 and I used this code for checking tommorrow
But my Output is: 1 month, 19 hours, 21 minutes and 11 seconds That Output is incorrect maybe because I'm in uae Now