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
Post a Comment