dates¶
Functions that concern dates and times.
Module summary¶
Functions
|
Convert date to unix time in seconds |
|
Convert Julian Date (relative 12h Jan 1, 4713 BC) to Modified Julian Date (relative 0h Nov 17, 1858) |
|
Convert Modified Julian Date (relative 0h Nov 17, 1858) to Julian Date (relative 12h Jan 1, 4713 BC) |
|
Converts a modified Julian date to a numpy datetime64 value (UTC) |
|
Converts a numpy datetime64 value to a date tuple |
|
Converts a numpy datetime64 value (UTC) to a modified Julian date |
|
Converts a numpy datetime64 value (UTC) to unix seconds |
|
Convert unix time in seconds to UTC date datetime object |
|
Convert unix time in seconds to Gregorian calendar UTC date-time formatted string |
Convert unix time in seconds to Gregorian calendar UTC date-time formatted string |
|
|
Converts unix seconds to a numpy datetime64 value (UTC) |
Contents¶
Functions
-
sorts.dates.
date_to_unix
(year, month, day, hour, minute, second)[source] Convert date to unix time in seconds
- Parameters
year (int) – Year as integer. Years preceding 1 A.D. should be 0 or negative. The year before 1 A.D. is 0, 10 B.C. is year -9.
month (int) – Month as integer, Jan = 1, Feb. = 2, etc.
day (int) – Day
hour (int) – Hour in 24h format
minute (int) – Minute
second (float) – Second, may contain fractional part.
- Returns
Unix time in seconds
- Return type
float
-
sorts.dates.
jd_to_mjd
(jd)[source] Convert Julian Date (relative 12h Jan 1, 4713 BC) to Modified Julian Date (relative 0h Nov 17, 1858)
-
sorts.dates.
mjd_to_jd
(mjd)[source] Convert Modified Julian Date (relative 0h Nov 17, 1858) to Julian Date (relative 12h Jan 1, 4713 BC)
-
sorts.dates.
mjd_to_npdt
(mjd)[source] Converts a modified Julian date to a numpy datetime64 value (UTC)
-
sorts.dates.
npdt_to_date
(dt)[source] Converts a numpy datetime64 value to a date tuple
- Parameters
dt (numpy.datetime64) – Date and time (UTC) in numpy datetime64 format
- Returns
tuple (year, month, day, hours, minutes, seconds, microsecond) all except usec are integer
-
sorts.dates.
npdt_to_mjd
(dt)[source] Converts a numpy datetime64 value (UTC) to a modified Julian date
-
sorts.dates.
npdt_to_unix
(dt)[source] Converts a numpy datetime64 value (UTC) to unix seconds
-
sorts.dates.
unix_to_date
(unix)[source] Convert unix time in seconds to UTC date datetime object
- Parameters
unix (float) – Unix time in seconds.
- Returns
Datetime object in UTC
- Return type
datetime.datetime
-
sorts.dates.
unix_to_datestr
(unix)[source] Convert unix time in seconds to Gregorian calendar UTC date-time formatted string
- Parameters
unix (float) – Unix time in seconds.
- Returns
Gregorian calendar UTC date-time formatted string
- Return type
str
-
sorts.dates.
unix_to_datestrf
(x)[source] Convert unix time in seconds to Gregorian calendar UTC date-time formatted string
Different implementation?
- Parameters
unix (float) – Unix time in seconds.
- Returns
Gregorian calendar UTC date-time formatted string
- Return type
str
-
sorts.dates.
unix_to_npdt
(unix)[source] Converts unix seconds to a numpy datetime64 value (UTC)