@@ -13,16 +13,15 @@ support datetime functionality. The data type is called "datetime64",
13
13
so named because "datetime" is already taken by the datetime library
14
14
included in Python.
15
15
16
- .. note :: The datetime API is *experimental* in 1.7.0, and may undergo changes
17
- in future versions of NumPy.
18
16
19
17
Basic Datetimes
20
18
===============
21
19
22
- The most basic way to create datetimes is from strings in
23
- ISO 8601 date or datetime format. The unit for internal storage
24
- is automatically selected from the form of the string, and can
25
- be either a :ref: `date unit <arrays.dtypes.dateunits >` or a
20
+ The most basic way to create datetimes is from strings in ISO 8601 date
21
+ or datetime format. It is also possible to create datetimes from an integer by
22
+ offset relative to the Unix epoch (00:00:00 UTC on 1 January 1970).
23
+ The unit for internal storage is automatically selected from the
24
+ form of the string, and can be either a :ref: `date unit <arrays.dtypes.dateunits >` or a
26
25
:ref: `time unit <arrays.dtypes.timeunits >`. The date units are years ('Y'),
27
26
months ('M'), weeks ('W'), and days ('D'), while the time units are
28
27
hours ('h'), minutes ('m'), seconds ('s'), milliseconds ('ms'), and
@@ -36,6 +35,11 @@ letters, for a "Not A Time" value.
36
35
37
36
>>> np.datetime64(' 2005-02-25' )
38
37
numpy.datetime64('2005-02-25')
38
+
39
+ From an integer and a date unit, 1 year since the UNIX epoch:
40
+
41
+ >>> np.datetime64(1 , ' Y' )
42
+ numpy.datetime64('1971')
39
43
40
44
Using months for the unit:
41
45
0 commit comments