且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在android中将时间戳作为字符串转换为日期

更新时间:2023-02-03 08:46:56

只要使用 时间类.尝试类似的方法.

Just use the Time class. Try something similar to this.

Time time = new Time();
time.set(Long.valueOf(yourTimeString));

如果你真的需要 Date 对象,试试这个.

If you really need a Date object just try this.

Date date = new Date(Long.parse(yourTimeString));