Time format in seconds since 0-Jan-0000
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jan Vandendriessche
el 18 de Abr. de 2020
Comentada: Jan Vandendriessche
el 21 de Abr. de 2020
Dear Matlab community,
I find myself having to work with a time format expressed in seconds since 0 January 0000. Or at least, I believe so. The given value equals 6.375053639947000e+10, which is indeed the amount of seconds in roughly 2020 years. Unfortunately, I can't find any Matlab function that could convert this into a 'normal' date and time.
Hopefully someone could help me out here,
Kind regards
Jan
3 comentarios
James Tursa
el 19 de Abr. de 2020
Editada: James Tursa
el 19 de Abr. de 2020
If you don't have an example pair of time & date, or some other definitive description of what the time frame is, then you will never be able to convert it with certainty. The best you can hope for is a conversion that gets you close to what you think is correct, but might not be correct.
What computer system & software was this accelerometer connected to when the measurements were made? Maybe that will give you a clue about the time frame used.
Respuesta aceptada
Cris LaPierre
el 18 de Abr. de 2020
d = datetime(0,0,0,0,0,6.375053639947000e10)
d =
01-Feb-2020 10:19:59
4 comentarios
Cris LaPierre
el 19 de Abr. de 2020
Editada: Cris LaPierre
el 19 de Abr. de 2020
I did little more playing around. Looks like datetime(0,0,0,0,0,0) is not what I expected:
d0 = datetime(0,0,0,0,0,0)
d0 =
30-Nov--0001
Since the date was off ~31 days, it got me thinking if I could make the date at least start January 1, I might get closer. I came up with 2 options
% Set month to January. Is Dec 31 -0001, or 1 day before Jan 1, 0000.
d0 = datetime(0,1,0,0,0,0)
d0 =
31-Dec--0001
% Use that same format when converting seconds
d = datetime(0,1,0,0,0,6.375053639947000e10)
d =
03-Mar-2020 10:19:59
Another way to get the same result is to sepcify the epoch and clock ticks using datetime. Now that I have an idea what the epoch value should be.
d2 = datetime(6.375053639947000e10,'ConvertFrom',...
'epochtime','Epoch','-0001-12-31','TicksPerSecond',1)
d2 =
03-Mar-2020 10:19:59
Más respuestas (0)
Ver también
Categorías
Más información sobre Calendar en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!