TimeObject

TimeObject[]

represents the current time.

TimeObject[{h,m,s}]

represents a time object of standard normalized form.

TimeObject[date]

gives the time component of the specified date representation.

TimeObject[rtime,gran]

gives the time object of granularity gran that includes the reference time rtime.

Details and Options

  • TimeObject[] uses whatever time has been set on your computer system by default.
  • Shorter lists can be used in TimeObject[{h,m,s}], which represents the time to whatever accuracy is specified: {h} is not treated as being equivalent to {h,0,0}.
  • TimeObject[rtime,gran] represents a granular element of time gran for the reference time rtime. For example, TimeObject[{10,4},"Minute"] represents the minute corresponding to 10:04 am.
  • In TimeObject[rtime,gran], the granularity gran can be any of the following:
  • "Hour"hour of the reference time
    "Minute"minute of the reference time
    "Second"second of the reference time
    "Instant"the exact specified time
  • TimeObject allows addition and subtraction of time quantities.
  • Subtracting two TimeObject constructs yields a time quantity.
  • The following options can be given:
  • TimeZone$TimeZonetime zone being used
  • TimeZone specifications should be a numerical offset from GMT, a time zone string or None.
  • Information of a TimeObject may include the following properties:
  • "Time"string form of the specified time
    "Granularity"time granularity
    "TimeZone"time zone

Examples

open allclose all

Basic Examples  (2)

Represent the current time:

Represent 11:30am:

Represent 15 seconds past 8:04pm:

Add 13 hours to a time object:

Subtracting time objects gives a time quantity:

Scope  (1)

Time objects are interpreted using their standard normalized form:

Options  (1)

TimeZone  (1)

Represent a specific time in Greenwich, United Kingdom:

Represent 11am Central Time:

Properties & Relations  (1)

Compare time objects to determine their sequence of occurrence:

Comparisons of time objects with unequal precision and overlapping time periods will return unevaluated:

Introduced in 2014
 (10.0)
 |
Updated in 2019
 (12.0)