FORCES
FORtran lib for Comp. Env. Sys.
|
Types to deal with datetimes. More...
Go to the source code of this file.
Data Types | |
module | mo_datetime::puredate |
This is a container to hold only a date. More... | |
module | mo_datetime::puretime |
This is a container to hold only a time. More... | |
module | mo_datetime::datetime |
This is a container to hold a date-time. More... | |
module | mo_datetime::timedelta |
This is a container to hold a defined time span. More... | |
Modules | |
module | mo_datetime |
Types to deal with datetimes. | |
Functions/Subroutines | |
pure type(timedelta) function, public | mo_datetime::zero_delta () |
zero time delta | |
pure type(timedelta) function, public | mo_datetime::one_week () |
one week time delta | |
pure type(timedelta) function, public | mo_datetime::one_day () |
one day time delta | |
pure type(timedelta) function, public | mo_datetime::one_hour () |
one hour time delta | |
pure type(timedelta) function, public | mo_datetime::one_minute () |
one minute time delta | |
pure type(timedelta) function, public | mo_datetime::one_second () |
one second time delta | |
pure type(puretime) function, public | mo_datetime::midnight () |
midnight (00:00) | |
pure type(puretime) function, public | mo_datetime::midday () |
midday (12:00) | |
pure type(puretime) function, public | mo_datetime::day_hour (hour) |
time for given hour | |
type(datetime) function, public | mo_datetime::now () |
get current datetime | |
type(puredate) function, public | mo_datetime::today () |
get todays puredate | |
type(puretime) function, public | mo_datetime::currently () |
get current puretime | |
pure integer(i4) function | mo_datetime::weekday (year, month, day) |
day of the week | |
pure logical function, public | mo_datetime::is_leap_year (year) |
whether a given year is a leap year | |
pure integer(i4) function, public | mo_datetime::days_in_month (year, month) |
number of days in a given month | |
pure integer(i4) function, public | mo_datetime::days_in_year (year) |
number of days in a given year | |
pure integer(i4) function | mo_datetime::days_before_year (year) |
number of days before a given year since year 1 | |
pure subroutine | mo_datetime::doy_to_month_day (year, doy, month, day) |
get date from day of the year | |
subroutine | mo_datetime::check_year (year) |
check if a given year is valid | |
subroutine | mo_datetime::check_month (month) |
check if a given month is valid | |
subroutine | mo_datetime::check_day (year, month, day) |
check if a given day is valid | |
subroutine | mo_datetime::check_hour (hour) |
check if a given hour is valid | |
subroutine | mo_datetime::check_minute (minute) |
check if a given minute is valid | |
subroutine | mo_datetime::check_second (second) |
check if a given second is valid | |
subroutine | mo_datetime::check_datetime (year, month, day, hour, minute, second) |
check if a datetime is valid | |
type(datetime) function | mo_datetime::dt_init (year, month, day, hour, minute, second) |
initialize a datetime | |
type(datetime) function | mo_datetime::dt_from_string (string) |
datetime from string | |
type(datetime) function | mo_datetime::dt_from_cf (string, value) |
datetime from cf-string and value | |
pure type(datetime) function | mo_datetime::dt_from_date_time (in_date, in_time) |
datetime from date and time | |
pure type(datetime) function | mo_datetime::dt_from_julian (julian, calendar) |
datetime from fractional julian day | |
type(datetime) function | mo_datetime::dt_replace (this, year, month, day, hour, minute, second) |
new datetime with specified fields | |
pure subroutine | mo_datetime::dt_copy_dt (this, that) |
copy a datetime | |
pure subroutine | mo_datetime::dt_copy_d (this, that) |
copy a datetime from a date | |
pure type(puredate) function | mo_datetime::get_date (this) |
date of the datetime | |
pure type(puretime) function | mo_datetime::get_time (this) |
time of the datetime | |
pure character(19) function | mo_datetime::dt_str (this) |
string representation of the datetime | |
pure real(dp) function | mo_datetime::dt_julian (this, calendar) |
datetime as fractional julian day | |
pure integer(i4) function | mo_datetime::dt_weekday (this) |
day of the week | |
pure integer(i4) function | mo_datetime::dt_doy (this) |
day of the year | |
pure logical function | mo_datetime::is_new_year (this) |
datetime is a new year | |
pure logical function | mo_datetime::is_new_month (this) |
datetime is a new month | |
pure logical function | mo_datetime::is_new_week (this) |
datetime is a new week | |
pure logical function | mo_datetime::is_new_day (this) |
datetime is a new day | |
pure logical function | mo_datetime::is_new_hour (this) |
datetime is a new hour | |
pure logical function | mo_datetime::is_new_minute (this) |
datetime is a new month | |
pure logical function | mo_datetime::dt_eq (this, that) |
equal comparison of datetimes | |
pure logical function | mo_datetime::dt_eq_d (this, that) |
equal comparison of datetime and date | |
pure logical function | mo_datetime::dt_neq (this, that) |
not equal comparison of datetimes | |
pure logical function | mo_datetime::dt_neq_d (this, that) |
not equal comparison of datetime and date | |
pure logical function | mo_datetime::dt_lt (this, that) |
less than comparison of datetimes | |
pure logical function | mo_datetime::dt_lt_d (this, that) |
less than comparison of datetime and date | |
pure logical function | mo_datetime::dt_gt (this, that) |
greater than comparison of datetimes | |
pure logical function | mo_datetime::dt_gt_d (this, that) |
greater than comparison of datetime and date | |
pure logical function | mo_datetime::dt_leq (this, that) |
less than or equal comparison of datetimes | |
pure logical function | mo_datetime::dt_leq_d (this, that) |
less than or equal comparison of datetime and date | |
pure logical function | mo_datetime::dt_geq (this, that) |
greater than or equal comparison of datetimes | |
pure logical function | mo_datetime::dt_geq_d (this, that) |
less than or equal comparison of datetime and date | |
pure type(datetime) function | mo_datetime::dt_add_td (this, that) |
add a timedelta to a datetime | |
pure type(datetime) function | mo_datetime::td_add_dt (that, this) |
add a timedelta to a datetime | |
pure type(datetime) function | mo_datetime::dt_sub_td (this, that) |
subtract a timedelta from a datetime | |
pure type(timedelta) function | mo_datetime::dt_sub_dt (this, that) |
difference between two datetimes | |
pure type(timedelta) function | mo_datetime::dt_sub_d (this, that) |
difference between datetime and date | |
type(puredate) function | mo_datetime::d_init (year, month, day) |
initialize a date | |
type(puredate) function | mo_datetime::d_from_string (string) |
date from string | |
pure type(puredate) function | mo_datetime::d_from_julian (julian, calendar) |
date from fractional julian day | |
type(puredate) function | mo_datetime::d_replace (this, year, month, day) |
new date with specified fields | |
pure type(datetime) function | mo_datetime::to_datetime (this) |
convert date to a datetime | |
pure integer(i4) function | mo_datetime::to_ordinal (this) |
convert date to number of days since year 1 | |
pure character(10) function | mo_datetime::d_str (this) |
string representation of the date | |
pure real(dp) function | mo_datetime::d_julian (this, calendar) |
date as fractional julian day | |
pure integer(i4) function | mo_datetime::d_weekday (this) |
day of the week | |
pure integer(i4) function | mo_datetime::d_doy (this) |
day of the year | |
pure logical function | mo_datetime::d_is_new_year (this) |
date is a new year | |
pure logical function | mo_datetime::d_is_new_month (this) |
date is a new month | |
pure logical function | mo_datetime::d_is_new_week (this) |
date is a new week | |
pure logical function | mo_datetime::d_eq (this, that) |
equal comparison of dates | |
pure logical function | mo_datetime::d_eq_dt (this, that) |
equal comparison of date and datetime | |
pure logical function | mo_datetime::d_neq (this, that) |
not equal comparison of dates | |
pure logical function | mo_datetime::d_neq_dt (this, that) |
not equal comparison of date and datetime | |
pure logical function | mo_datetime::d_lt (this, that) |
less than comparison of dates | |
pure logical function | mo_datetime::d_lt_dt (this, that) |
less than comparison of date and datetime | |
pure logical function | mo_datetime::d_gt (this, that) |
greater than comparison of dates | |
pure logical function | mo_datetime::d_gt_dt (this, that) |
greater than comparison of date and datetime | |
pure logical function | mo_datetime::d_leq (this, that) |
less than or equal comparison of dates | |
pure logical function | mo_datetime::d_leq_dt (this, that) |
less than or equal comparison of date and datetime | |
pure logical function | mo_datetime::d_geq (this, that) |
greater than or equal comparison of dates | |
pure logical function | mo_datetime::d_geq_dt (this, that) |
greater than or equal comparison of date and datetime | |
pure type(puredate) function | mo_datetime::d_add_td (this, that) |
add a timedelta to a date | |
pure type(puredate) function | mo_datetime::td_add_d (that, this) |
add a timedelta to a date | |
pure type(puredate) function | mo_datetime::d_sub_td (this, that) |
subtract a timedelta from a date | |
pure type(timedelta) function | mo_datetime::d_sub_d (this, that) |
difference between two dates | |
pure type(timedelta) function | mo_datetime::d_sub_dt (this, that) |
difference between date and datetime | |
type(puretime) function | mo_datetime::t_init (hour, minute, second) |
initialize a time | |
type(puretime) function | mo_datetime::t_from_string (string) |
time from string | |
pure type(puretime) function | mo_datetime::t_from_day_second (day_second) |
time from day second | |
pure subroutine | mo_datetime::t_copy (this, that) |
copy a time | |
type(puretime) function | mo_datetime::t_replace (this, hour, minute, second) |
new time with specified fields | |
pure character(8) function | mo_datetime::t_str (this) |
string representation of the time | |
pure integer(i4) function | mo_datetime::t_day_second (this) |
time to second of the day | |
pure logical function | mo_datetime::t_is_new_day (this) |
time is a new day / midnight | |
pure logical function | mo_datetime::t_is_new_hour (this) |
time is a new hour | |
pure logical function | mo_datetime::t_is_new_minute (this) |
time is a new month | |
pure logical function | mo_datetime::t_eq (this, that) |
equal comparison of times | |
pure logical function | mo_datetime::t_neq (this, that) |
not equal comparison of times | |
pure logical function | mo_datetime::t_lt (this, that) |
less than comparison of times | |
pure logical function | mo_datetime::t_gt (this, that) |
greater than comparison of times | |
pure logical function | mo_datetime::t_leq (this, that) |
less than or equal comparison of times | |
pure logical function | mo_datetime::t_geq (this, that) |
greater than or equal comparison of times | |
pure type(puretime) function | mo_datetime::t_add_td (this, that) |
add a timedelta to a time | |
pure type(puretime) function | mo_datetime::td_add_t (that, this) |
add a timedelta to a time | |
pure type(puretime) function | mo_datetime::t_sub_td (this, that) |
subtract a timedelta from a time | |
pure type(timedelta) function | mo_datetime::t_sub_t (this, that) |
difference between two times | |
pure type(timedelta) function | mo_datetime::td_init (days, seconds, minutes, hours, weeks) |
initialize a timedelta | |
pure type(timedelta) function | mo_datetime::td_abs (this) |
absolute timedelta | |
pure integer(i8) function | mo_datetime::td_total_seconds (this) |
timedelta in seconds (may need i8) | |
pure type(timedelta) function | mo_datetime::from_total_seconds (total_seconds) |
pure subroutine | mo_datetime::td_copy (this, that) |
copy a timedelta | |
pure logical function | mo_datetime::td_eq (this, that) |
equal comparison of timedeltas | |
pure logical function | mo_datetime::td_neq (this, that) |
not equal comparison of timedeltas | |
pure logical function | mo_datetime::td_lt (this, that) |
less than comparison of timedeltas | |
pure logical function | mo_datetime::td_gt (this, that) |
greater than comparison of timedeltas | |
pure logical function | mo_datetime::td_leq (this, that) |
less than or equal comparison of timedeltas | |
pure logical function | mo_datetime::td_geq (this, that) |
greater than or equal comparison of timedeltas | |
pure type(timedelta) function | mo_datetime::td_add (this, that) |
adding two timedeltas | |
pure type(timedelta) function | mo_datetime::td_sub (this, that) |
adding two timedeltas | |
pure type(timedelta) function | mo_datetime::td_neg (this) |
negative timedelta | |
pure type(timedelta) function | mo_datetime::td_pos (this) |
positive timedelta | |
pure type(timedelta) function | mo_datetime::td_mul1 (this, that) |
multiply a timedelta with an integer | |
pure type(timedelta) function | mo_datetime::td_mul2 (that, this) |
multiply a timedelta with an integer | |
pure type(timedelta) function | mo_datetime::td_mul1_dp (this, that) |
multiply a timedelta with a real | |
pure type(timedelta) function | mo_datetime::td_mul2_dp (that, this) |
multiply a timedelta with a real | |
pure type(timedelta) function | mo_datetime::td_div (this, that) |
divide a timedelta by an integer | |
pure type(timedelta) function | mo_datetime::td_div_dp (this, that) |
divide a timedelta by a real | |
pure real(dp) function | mo_datetime::td_div_td (this, that) |
divide a timedelta by a timedelta | |
Variables | |
integer(i4), parameter, public | mo_datetime::year_days = 365_i4 |
days in standard year | |
integer(i4), parameter, public | mo_datetime::leap_year_days = 366_i4 |
days in leap year | |
integer(i4), parameter, public | mo_datetime::year_months = 12_i4 |
months in year | |
integer(i4), parameter, public | mo_datetime::week_days = 7_i4 |
days in week | |
integer(i4), parameter, public | mo_datetime::day_hours = 24_i4 |
hours in day | |
integer(i4), parameter, public | mo_datetime::clock_hours = 12_i4 |
hours on a clock | |
integer(i4), parameter, public | mo_datetime::hour_minutes = 60_i4 |
minutes in hour | |
integer(i4), parameter, public | mo_datetime::minute_seconds = 60_i4 |
seconds in minute | |
integer(i4), parameter, public | mo_datetime::day_minutes = DAY_HOURS * HOUR_MINUTES |
minutes in day | |
integer(i4), parameter, public | mo_datetime::day_seconds = DAY_MINUTES * MINUTE_SECONDS |
seconds in day | |
integer(i4), parameter, public | mo_datetime::hour_seconds = HOUR_MINUTES * MINUTE_SECONDS |
seconds in hour | |
integer(i4), parameter, public | mo_datetime::week_hours = WEEK_DAYS * DAY_HOURS |
hours in week | |
integer(i4), parameter, public | mo_datetime::week_minutes = WEEK_DAYS * DAY_MINUTES |
minutes in week | |
integer(i4), parameter, public | mo_datetime::week_seconds = WEEK_DAYS * DAY_SECONDS |
seconds in week | |
integer(i4), parameter | mo_datetime::min_year = 1_i4 |
minimum for year | |
integer(i4), parameter | mo_datetime::max_year = 9999_i4 |
maximum for year | |
Types to deal with datetimes.
This module provides four types to deal with date and time
These type can be used in arithmetic operations (+, -, *, /) and can be compared (<, >, <=, >=, ==, /=) where it makes sense.
The following example demonstrates the functionality:
Several special constants are provided as well:
Provided convenience routines:
A date is assumed to be given in the gregorian calender. That means, there is a leap year (February has 29 days instead of 28) if:
COPYING
and COPYING.LESSER
provided with this software. The complete GNU license text can also be found at http://www.gnu.org/licenses/. Definition in file mo_datetime.f90.