Extracting date strings from the JavaScript Date object without timezones being applied -



Extracting date strings from the JavaScript Date object without timezones being applied -

i want straight conversion of date string , cannot results expect. expect below code produce date equal date portion of original string, seems apply time during instance creation.

var usagetime = new date('2012-01-19t22:59:50-0800'); console.log(usagetime); // fri, 20 jan 2012 06:59:50 gmt dayofusage = usagetime.getfullyear()+'-'+(usagetime.getmonth()+1)+'-'+usagetime.getdate(); console.log(dayofusage); // 2012-1-20

i expect date of 2012-1-19. right way solve this?

you should utilize getutc*() functions (getutcdate(), getutchours() , on) times no timezone offset.

javascript date

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -