Borrar filtros
Borrar filtros

how convert 13 digits of timestamp?

6 visualizaciones (últimos 30 días)
nada ali
nada ali el 5 de Jul. de 2015
Respondida: Walter Roberson el 8 de Jul. de 2015
*hi,
how convert 13 digits of timestamp like 1238536800000 into small number with 6 digits It is easy to deal with it.
THANKS *
  7 comentarios
Stephen23
Stephen23 el 7 de Jul. de 2015
Editada: Stephen23 el 7 de Jul. de 2015
@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 el 7 de Jul. de 2015
Editada: nada ali el 7 de Jul. de 2015
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*

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Jul. de 2015
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.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 5 de Jul. de 2015
Editada: Azzi Abdelmalek el 5 de Jul. de 2015
use
format short
or
s=1238536800000
fprintf('%6.6g\n',s)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by