필터 지우기
필터 지우기

how convert 13 digits of timestamp?

조회 수: 6 (최근 30일)
nada ali
nada ali 2015년 7월 5일
답변: Walter Roberson 2015년 7월 8일
*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
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.
nada ali
nada ali 2015년 7월 7일
편집: nada ali 2015년 7월 7일
thanks I just found the dataset with the following format including timestamp
*userID artistID tagID timestamp
2 52 13 1238536800000
2 52 15 1238536800000
2 52 18 1238536800000
2 52 21 1238536800000
2 52 41 1238536800000*

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
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.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 5일
편집: Azzi Abdelmalek 2015년 7월 5일
use
format short
or
s=1238536800000
fprintf('%6.6g\n',s)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by