convert date and time in seconds
Afficher commentaires plus anciens
Hello everyone, I have a table with several variables. Among others, I have 2 columns with date and time. These 2 columns are cells with strings ('iscellstr'=1 and 'ischar'=0). How can I convert them in seconds? thank you very much!
7 commentaires
Walter Roberson
le 4 Sep 2018
You could calculate number of seconds since some event, such as by converting serial date numbers from days into seconds. This would, however, be prone to errors due to leap seconds and calendar changes that happened at different dates in different parts of the world.
Nivodi
le 4 Sep 2018
jonas
le 4 Sep 2018
But you will also get unique values if you convert the time stamps (date+time) to a datetime array. Unless there is a specific reason you need the data to be in seconds (or any other duration), then I'd strongly recommend simply converting your time-vector to a datetime array and work with that.
Nivodi
le 4 Sep 2018
Modifié(e) : Walter Roberson
le 4 Sep 2018
jonas
le 4 Sep 2018
Not sure what you are doing, but that is not the correct syntax. I wrote some lines of code in the answer section to give you an idea of what I meant.
Nivodi
le 4 Sep 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!