I developing an android application using titanium in that i need to convert the Milliseconds time to UTC local time format.For that i tried several js but didn't worked out.
Perfect link that converts milliseconds to local time
My millisecond time format will be 1396250512
I need to convert to local time like Monday, March 31, 2014 12:51:51 PM
new Date(+new Date * 1000).toLocaleString()
i used this to convert ms to local time..But Each time i trying the above code gives me different time.
I developing an android application using titanium in that i need to convert the Milliseconds time to UTC local time format.For that i tried several js but didn't worked out.
Perfect link that converts milliseconds to local time
My millisecond time format will be 1396250512
I need to convert to local time like Monday, March 31, 2014 12:51:51 PM
new Date(+new Date * 1000).toLocaleString()
i used this to convert ms to local time..But Each time i trying the above code gives me different time.
Share Improve this question asked Mar 31, 2014 at 7:23 GK_GK_ 1,2221 gold badge12 silver badges29 bronze badges1 Answer
Reset to default 5I don't know about the Titanium. But using javascript here is the way.
var time = new Date().getTime(); // Get milliseconds
var date = new Date(time);// Milliseconds to date
alert(date.toString());
var time = 1396250512;
var date = new Date(time);// Milliseconds to date
alert(date.toString());
Get time only
var time = 1396250512;
var date = new Date(time);// Milliseconds to date
var t=date.toString().split(" ");
alert(t[4]);