This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Current date and time as serial date number


t = now


t = now returns the current date and time as a serial date number. A serial date number represents the whole and fractional number of days from a fixed, preset date (January 0, 0000).

floor(now) returns the current date as a serial date number, and rem(now,1) returns the current time as a serial date number. datestr(now) returns the current date and time as text.


t1 = now, t2 = rem(now,1)

t1 =


t2 =



  • To return a datetime scalar representing the current date and time, type:

    t = datetime('now')

Introduced before R2006a

Was this topic helpful?