Effacer les filtres
Effacer les filtres

how to convert to standard date and time

1 vue (au cours des 30 derniers jours)
Ruben Llamas
Ruben Llamas le 6 Juil 2012
HELLO...
I am using a sensor to collect some data and the data file output is giving me the date and time as follows:
1.37303200000000 1.38359200000000 1.39406100000000 1.40446400000000 1.41493300000000 1.42549300000000 1.43596200000000 1.44643200000000 1.35280200000000 1.36327200000000 1.37383200000000 1.38423400000000 1.39470400000000 1.40517300000000 1.41573300000000 1.42620200000000 1.43667200000000 1.60434400000000 1.61490400000000 1.62530600000000 1.63577600000000 1.64624500000000 1.65680500000000 1.66727400000000 1.67774400000000 1.68814600000000 1.69870600000000 1.70917600000000 1.71964500000000 1.73011400000000 1.74067400000000 1.75107700000000 1.76154600000000 1.77201600000000 1.78257600000000 1.79304500000000 1.80351400000000 1.81400800000000 1.82447700000000 1.83494600000000 1.84541600000000 1.85597600000000 1.86644500000000 1.87684800000000 1.88731700000000 1.89787700000000 1.90834600000000 1.91881600000000 1.92928500000000 1.93977800000000 1.95024800000000 1.96071700000000 1.97118600000000 1.98174600000000 1.99221600000000 2.00319400000000 2.01366400000000 2.02422400000000 2.03469300000000 2.04516200000000 2.05565600000000 2.06612500000000 2.07659400000000 2.08706400000000 2.09762400000000 2.10809300000000 2.11849600000000 2.12896500000000 2.13952500000000 2.14999400000000 2.16046400000000 2.17093300000000 2.18142600000000 2.19189600000000 2.20236500000000 2.21283400000000 2.22339400000000 2.23386400000000 2.24426600000000 2.25473600000000 2.26529600000000 2.27576500000000 2.28623400000000 2.29672800000000 2.30719700000000 2.31766600000000 2.32813600000000 2.33869600000000 2.34916500000000 2.35956800000000 2.37003700000000 2.38059700000000 2.39106600000000 2.40153600000000 2.41200500000000 2.42249800000000 2.43296800000000 2.44343700000000 2.45390600000000 2.46446600000000 2.47486900000000 2.48533800000000 2.49580800000000 2.50636800000000 2.51683700000000 2.52730600000000 2.53780000000000 2.54826900000000 2.55873800000000 2.56920800000000 2.57976800000000 2.59017000000000 2.60064000000000 2.61110900000000 2.62166900000000 2.63213800000000 2.64260800000000 2.65301000000000 2.66357000000000 2.67404000000000 2.68450900000000 2.69497800000000 2.70547200000000 2.71600800000000 2.72647700000000 2.73688000000000 2.74744000000000 2.75790900000000 2.76837800000000 2.77884800000000 2.78940800000000 2.79981000000000 2.81028000000000 2.82084000000000 2.83130900000000 2.84177800000000 2.85224800000000 2.86274100000000 2.87321000000000 2.88368000000000 2.89414900000000
I would like to know how can I convert these to standard date and time?
Thanks in advance for your help and time,
Ruben Llamas

Réponses (2)

F.
F. le 6 Juil 2012
help datestr (for the function and to define the format ...)
try:
datestr(now, 'mmmm dd, yyyy HH:MM:SS.FFF AM')
  2 commentaires
Ruben Llamas
Ruben Llamas le 6 Juil 2012
I have done it, but I don't get a right date and time. For example 1.373032 needs to give 2012-06-26 15:26:17.374 and it does!
F.
F. le 6 Juil 2012
but
datenum( '2012-06-26 15:26:17.374', 'yyyy-mm-dd HH:MM:SS.FFF' )
gives 7.3505e+005 ????

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 6 Juil 2012
Modifié(e) : Walter Roberson le 6 Juil 2012
datestr() might be appropriate, but we need to know how the times are encoded. For example, in the sample data, does 1.37303200000000 actually mean "1 hour 37 minutes, 30.320 seconds" ?
  4 commentaires
Star Strider
Star Strider le 6 Juil 2012
How did you convert '1.373032' to '2012-06-26 15:26:17.374'? Your sensor software documentation must have some information about how it encodes dates and times. Share that information here and it may be possible to calculate MATLAB date numbers from them.
Walter Roberson
Walter Roberson le 6 Juil 2012
If the time scheme is linear (which we do not know yet), then if you give us two timestamps and two exact conversions of those timestamps, then we can figure out the conversion. Provided, that is, that the timestamps are not relative to some time that is given in a file header line and which you have omitted showing in your question. (Times relative to a particular time are a common time format in log files.)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by