Documentation

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

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

collapse all

Tips

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

    t = datetime('now')

Introduced before R2006a

Was this topic helpful?