summaryrefslogtreecommitdiff
path: root/doc/source/reference
diff options
context:
space:
mode:
authorKasia <kati.leszek@gmail.com>2021-05-09 15:17:54 +0000
committerKasia <kati.leszek@gmail.com>2021-05-09 15:17:54 +0000
commitb5e09ff7b3143227ced311e714c40b588c74ea4a (patch)
tree6f561d7af9236023d04fb07fa2fbf8319041009f /doc/source/reference
parent7c61d16aa6a09172dc35662c0005fc2e289e403d (diff)
downloadnumpy-b5e09ff7b3143227ced311e714c40b588c74ea4a.tar.gz
DOC: Improve datetime64 docs #14299
Diffstat (limited to 'doc/source/reference')
-rw-r--r--doc/source/reference/arrays.datetime.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/source/reference/arrays.datetime.rst b/doc/source/reference/arrays.datetime.rst
index c5947620e..7c789b8e8 100644
--- a/doc/source/reference/arrays.datetime.rst
+++ b/doc/source/reference/arrays.datetime.rst
@@ -20,9 +20,9 @@ Basic Datetimes
===============
The most basic way to create datetimes is from strings in
-ISO 8601 date or datetime format. The unit for internal storage
-is automatically selected from the form of the string, and can
-be either a :ref:`date unit <arrays.dtypes.dateunits>` or a
+ISO 8601 date, datetime format or from integer to UNIX time.
+The unit for internal storage is automatically selected from the
+form of the string, and can be either a :ref:`date unit <arrays.dtypes.dateunits>` or a
:ref:`time unit <arrays.dtypes.timeunits>`. The date units are years ('Y'),
months ('M'), weeks ('W'), and days ('D'), while the time units are
hours ('h'), minutes ('m'), seconds ('s'), milliseconds ('ms'), and
@@ -36,6 +36,11 @@ letters, for a "Not A Time" value.
>>> np.datetime64('2005-02-25')
numpy.datetime64('2005-02-25')
+
+ UNIX time, by providing integer and a date unit:
+
+ >>> np.datetime64(1, 'Y')
+ numpy.datetime64('1971')
Using months for the unit: