最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

titanium - convert milliseconds and to local time and date javascript - Stack Overflow

programmeradmin2浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 5

I 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]);
发布评论

评论列表(0)

  1. 暂无评论