cf.dt¶
-
cf.
dt
(*args, **kwargs)[source]¶ Return a date-time variable for a given date and time.
The date and time may be specified with an ISO 8601-like date-time string (in which non-Gregorian calendar dates are allowed) or by providing a value for the year and, optionally, the month, day, hour, minute, second and microsecond.
See also
Parameters: - args, kwargs :
If the first positional argument is a string, then it must be an ISO 8601-like date-time string from which a
cf.Datetime
object is initialized. Otherwise, the positional and keyword arguments are used to explicitly initialize acf.Datetime
object, so seecf.Datetime
for details.
Returns: - out : cf.Datetime
The new date-time object.
Examples: >>> d = cf.dt(2003, 2, 30) >>> d = cf.dt(2003, 2, 30, 0, 0, 0) >>> d = cf.dt('2003-2-30') >>> d = cf.dt('2003-2-30 0:0:0')
>>> d = cf.dt(2003, 4, 5, 12, 30, 15) >>> d = cf.dt(year=2003, month=4, day=5, hour=12, minute=30, second=15) >>> d = cf.dt('2003-04-05 12:30:15') >>> d.year, d.month, d.day, d.hour, d.minute, d.second (2003, 4, 5, 12, 30, 15)