now

Current date and time as serial date number

Syntax

t = now

Description

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 a string.

Examples

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

t1 =

   7.2908e+05


t2 =

    0.4013

More About

expand all

Tips

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

    t = datetime('now')
Was this topic helpful?