Return a datetime variable for a given date and time.
The date and time may be specified with an ISO 8601-like datetime string (i.e. non-Gregorian calendar dates are allowed) or by providing separate values for the year, month, day, hour, minute and second.
Valid datetime string
Parameters : |
|
---|---|
Returns : |
|
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)