Time format in seconds since 0-Jan-0000

18 visualizaciones (últimos 30 días)
Jan Vandendriessche
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
Jan Vandendriessche
Jan Vandendriessche el 19 de Abr. de 2020
I'm afraid I don't. The origin of the time variable is the start of some measurements carried out with a GeoSIG accelerometer. This was done on the 3rd of march this year, somewhere near 11am.
James Tursa
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.

Iniciar sesión para comentar.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 18 de Abr. de 2020
You could use datetime.
d = datetime(0,0,0,0,0,6.375053639947000e10)
d =
01-Feb-2020 10:19:59
  4 comentarios
Cris LaPierre
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
Jan Vandendriessche
Jan Vandendriessche el 21 de Abr. de 2020
Wow, thanks a lot! This should be almost spot on. Very much appreciated!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by