gcpy.date_time
Internal utilities for managing datetime objects and strings
Functions
|
Adds a given number of months to a numpy.datetime64 date. |
|
Convenience routine to convert a numpy.datetime64 object to a date/time string. |
|
Convenience function returning the datetime timestamp based on the given input. |
|
Verifies if two dates span a full year starting on January 1st. |
- gcpy.date_time.get_timestamp_string(date_array)[source]
Convenience function returning the datetime timestamp based on the given input.
- gcpy.date_time.add_months(start_date, n_months)[source]
Adds a given number of months to a numpy.datetime64 date.
- Parameters:
start_date (
numpy.datetime64) – The starting date.n_months (
int) – Number of months to add to start_date.
- Returns:
new_date – Date with exactly n_months added to start_date.
- Return type:
- gcpy.date_time.is_full_year(start_date, end_date)[source]
Verifies if two dates span a full year starting on January 1st.
- Parameters:
start_date (
numpy.datetime64) – The starting date.end_date (
numpy.datetime64) – The ending date.
- Returns:
result – True if end_date is exactly 12 months after start_date and start_date falls on January 1st; False otherwise.
- Return type:
- gcpy.date_time.datetime64_to_str(timestamp, format_str='%Y-%m-%d')[source]
Convenience routine to convert a numpy.datetime64 object to a date/time string.
- Parameters:
timestamp (
numpy.datetime64) – Date and time to be converted.format_str (
str, optional) – Format string for the output date/time string. Default value: ‘%Y-%m-%d’
- Returns:
date_str – String representation of timestamp formatted according to format_str.
- Return type: