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 (i.e. non-Gregorian calendar dates are allowed) or by providing separate values for the year, month, day, hour, minute and second.

Valid date-time string

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 initialize explicitly a cf.Datetime object, so see cf.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)

Previous topic

cf.dtne

Next topic

cf.year

This Page