1

I have got this:

startDate = new Date(); startDate = new Date(Date.parse('2014-10-20')); finishDate = new Date(); finishDate = new Date(Date.parse('2014-11-21')); 
  • The startDate is Mon Oct 20 2014 01:00:00 GMT+0100 (Hora de Verão de GMT);
  • The finishDate is Fri Nov 21 2014 00:00:00 GMT+0000 (Hora padrão de GMT);

You can see the GMT+0100 in the startDate and not in the finishDate, possibly because after 26 October the winter time is on.

I want to get those dates without regard to the timezone, winter or summer time.

4
  • You have a lot of work ahead of you mate. You might want to look into date.js for that. Commented Jan 26, 2015 at 15:34
  • date.js has been abandoned, moment.js kind of replaced it. I'm looking for a solution without any of them Commented Jan 26, 2015 at 15:39
  • Your question is non-sensical on its face. Non-UTC dates always have a time, because for me, Oct 20 (EST) is different than it is for you (in whatever timezone you're in). The only way to avoid that it to use an actual UTC date, which gives you ticks from a fixed date in the past. Commented Jan 26, 2015 at 15:39
  • You may want to look into @Scimonster's answer. He nailed it. UTC time is the way to go. Commented Jan 26, 2015 at 15:42

1 Answer 1

1

You could use Date#toUTCString(). This will return a string with the date in UTC timezone, which naturally will ignore daylight savings time.

Sign up to request clarification or add additional context in comments.

5 Comments

Actually, UTC doesn't "ignore" time savings. It silently skips the dates to the correct times, to my understanding. But yes, this is the only way. You beat me for a moment.
UTC just isn't affected by DST.
Actually, it "silently" is. I have no idea when the last time the hour changed. But lets imagine that it was today. Today, 1am would be invalid and would pass to 2am, for example. I hope I'm not wrong. It would be embarassing, since I live in the UTC (gmt+00:00 and gmt+01:00) timezone.
UTC really isn't affected. You only live in UTC part of the time, apparently.
Probably. Honestly, I'm kinda messed up :/ But you might be right. You might be wrong. Wikipedia wasn't helpful to me this time.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.