how convert 13 digits of timestamp?
6 次查看(过去 30 天)
显示 更早的评论
*hi,
how convert 13 digits of timestamp like 1238536800000 into small number with 6 digits It is easy to deal with it.
THANKS *
7 个评论
Stephen23
2015-7-7
编辑:Stephen23
2015-7-7
@nada ali: what epoch and increment does that timestamp have? Without knowing what time system or encoding this timestamp uses, your question is impossible to answer.
采纳的回答
Walter Roberson
2015-7-8
Divide the 13 digit timestamp by 1000 to get seconds. Divide by 24 * 60 * 60 to get days. Add datenum('1970-1-1'). The result will be a MATLAB date number.
This task would have been easier if you had identified the source of the data; I tracked it down by searching on the heading you provided and showed that it was an extract of last.fm data. After that it was a matter of researching to find out what timestamp format that last.fm used. When that was unsuccessful I took a sample timestamp from the last.fm site and googled it and was fortunate to find a discussion about Drupal in which someone was asking about proper conversion of the timestamp, and that gave me a target date to reverse-engineer from. The rest was based upon my historical knowledge of Unix timestamps starting at January 1 1970.
0 个评论
更多回答(1 个)
Azzi Abdelmalek
2015-7-5
编辑:Azzi Abdelmalek
2015-7-5
use
format short
or
s=1238536800000
fprintf('%6.6g\n',s)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!