datetime - remove the local timezone from a date in javascript? -


i wondering if can remove timezone date using javascript? datetime on json format want set returns more info of want/need.

what have is:

var d = new date(); d.settime(1432851021000); document.write(d); 

and output this:

thu may 28 2015 16:10:21 gmt-0600 (cst) 

id show until hour, , moreve gmt-0600 (cst).

i know javascript takes depending on current user's timezone, problem, because information saved on different countries.

i trying avoid create format using like:

d.date() + "/" + d.month()...etc 

is there better solution this?

i believe d.todatestring() output format you're looking for.

var d = new date(); d.settime(1432851021000); d.todatestring(); // outputs "thu may 28 2015" d.togmtstring(); //outputs "thu, 28 may 2015 22:10:21 gmt" 

or d.tolocalestring() "5/28/2015, 6:10:21 pm"

there lots of methods available date()


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -