date - How to get correct UTC time in javascript? -


i want current date utc midnight:

var d = new date(); d.setutchours(0,0,0,0); console.log(d.toisostring()) 

this returns me:

2016-04-21t00:00:00.000z 

is utc time? think not , should be:

2016-04-20t22:00:00.000z 

if want have midnight of time zone in utc time code following:

var d = new date(); d.sethours(0,0,0,0); console.log(d.toisostring()); 

Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -