Does it exist a function which is similar to time() function of C ambient ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Damiano Capocci
le 10 Oct 2017
Commenté : Peter Perkins
le 13 Oct 2017
Hi, i'm working with random number generation, I would like to know if exists, in Matlab, a function like time(0) of C ambient (like emacs) which gives the number of seconds from a certain day.
0 commentaires
Réponse acceptée
Jan
le 11 Oct 2017
Modifié(e) : Jan
le 11 Oct 2017
The number of seconds of the current day:
s = rem(now, 1) * 86400;
Number of seconds since 17-Mar-2011:
s = (now - datenum('17-Mar-2011')) * 86400;
This does not use the modern datetime object.
2 commentaires
Steven Lord
le 11 Oct 2017
For datetime:
s2 = seconds(datetime('now')-datetime(2011, 3, 17))
Peter Perkins
le 13 Oct 2017
Or for that matter,
>> round(posixtime(datetime('now')))
ans =
1507893971
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Sources 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!