I am based in Australia and while new Date()
give me the current date and time in Australia, for instance
Fri Aug 26 2016 09:16:16 GMT+1000 (AUS Eastern Standard Time)
, if I write new Date().toJSON()
I get 2016-08-25T23:20:08.242Z
,
how can I get the same format as in yyyy-mm-ddThh:mn:ss
but keeping my local day and time, ie it should be the 26 and not the 25th.
Edit: when I write programmatically new Date(2016, 11, x)
with var x = 31
, using toJSON()
I have no guarantee to see displayed 2016-12-31
because of timezones, so was wondering is there is a different javascript function that would give me the intended result.