Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将时间戳(例如 1333699439)转换为 2008-07-17T09:24:17?
目前在firebase中,我正在使用-时间戳:Firebase.ServerValue.TIMESTAMP。
服务器以秒为单位返回时间戳所以你需要乘以千来获得以毫秒为单位的时间戳
var myDate = new Date(timestamp*1000); var formatedTime=myDate.toJSON();
这formatedTime 是您需要的格式
formatedTime
您可以使用 javascript Date 对象来执行此操作。
var myDate = new Date(timestamp_in_millis*1000);