I want to parse a date without a timezone in JavaScript. I tried:
new Date(Date.parse("2005-07-08T00:00:00+0000"));
Which returned Fri Jul 08 2005 02:00:00 GMT+0200
(Central European Daylight Time):
new Date(Date.parse("2005-07-08 00:00:00 GMT+0000"));
returns the same result and:
new Date(Date.parse("2005-07-08 00:00:00 GMT-0000"));
also returns the same result.
I want to parse time:
- without time zone.
- without calling a constructor
Date.UTC
or newDate(year, month, day)
. - by simply passing a string into the Date constructor (without prototype approaches).
I have to produce a Date object, not a String.
Date.parse
btw and directly pass the string to theDate
constructor. – AllegraallegrettoDate
object to obtain correct object to compare dates in MongoDB:new Date(dateStart.getFullYear(), dateStart.getMonth(), dateStart.getDate())
– Hedgehog