![]() |
libSUFR
a LIBrary of Some Useful Fortran Routines
|
Procedures for manipulation of date and time. More...
Functions/Subroutines | |
| elemental real(double) function | cal2jd (yy, mm, dd) |
| Convert a calendar date to JD. Input and output in UT. | |
| elemental subroutine | jd2cal (jd, yy, mm, dd) |
| Convert a Julian day to a calendar date (fractional day) - in UT. | |
| elemental real(double) function | year2jd (year) |
| Convert a year (with decimals) to a JD. Input and output in UT. | |
| elemental subroutine | jd2ymdhms (jd, yy, mm, d, h, m, s) |
| Convert a Julian day to date and time (h,m,s, UT) | |
| elemental character function, dimension(15) | jd2datestr (jd) |
| Convert a Julian day to a date string (yyyy-mm-dd) | |
| elemental real(double) function | jd2time (jd) |
| Convert a Julian day to time (UT, h) | |
| elemental real(double) function | jd2year (jd) |
| Convert a Julian day to decimal year (e.g. 2000.0) | |
| elemental subroutine | jd2datetime (jd, year, month, day, time) |
| Convert a Julian day to a date (y,m,d) and time (UT, h) | |
| elemental real(double) function | ymdhms2jd (yy, mmo, dd, h, m, s) |
| Convert date and time (y,m,d, h,m,s) to JD. Input and output in UT. | |
| elemental subroutine | consistent_date_time (year, month, day, hour, minute, second) |
| Ensure date and time are consistent after manipulation (0<month<13, 0<=minute<60, etc.) | |
| elemental real(double) function | dtm2jd (yy, mo, dd, time) |
| Convert date and time (h) to a Julian day - input in UT. | |
| elemental subroutine | tm2hm (tm, h, m) |
| Convert time (h) to hours and (integer) minutes. | |
| elemental subroutine | tm2hmm (tm, h, m) |
| Convert time (h) to hours and (decimal) minutes. | |
| elemental subroutine | tm2hms (tm, h, m, s) |
| Convert time (h) to hours, minutes and (integer) seconds. | |
| elemental subroutine | tm2hmss (tm, h, m, s) |
| Convert time (h) to hours, minutes and (decimal) seconds. | |
| elemental integer function | dow_ut (jd0) |
| Calculates day of week (0 = Sunday, ..., 6 = Saturday). Output for timezone of input - call dow_ut(jd+tz/24.d0) for local time. | |
| elemental integer function | dow_iso (jd0) |
| Calculates ISO day of week (1 = Monday, ..., 7 = Sunday). Output for timezone of input - call dow_ut(jd+tz/24.d0) for local time. | |
| elemental integer function | doy (jd0) |
| Calculate day of year (1-366) from JD. | |
| elemental integer function | ymd2doy (yr, mon, dy) |
| Calculate day of year (1-366) from year,month,day. | |
| elemental subroutine | doy2md (doy, yr, mon, dy) |
| Calculate month and day from day of year and year. | |
| elemental integer function | leapyr (yr) |
| Calculate whether year is leap (1) or not (0). The number of days in February is then given by 28 + leapyr(yr) and number of days in a year by 365 + leapyr(yr) | |
| elemental character function, dimension(30) | jd2iso8601 (jd, tz) |
| Return JD as date and time in ISO_8601 format (e.g. 2014-03-24T20:48:01+00:00) | |
| elemental character function, dimension(35) | jd2rfc822 (jd, tz) |
| Return JD as date and time in RFC-822 format (e.g. Sat, 07 Sep 2002 23:12:01 +0100) | |
| real(double) function | jd2gps (jd) |
| Convert a Julian day (UT) to a GPS time (seconds since 1980-01-06 - 2000-01-01 = 630720013.0) | |
| real(double) function | gps2jd (gpstime) |
| Convert a GPS time to Julian day (UT) | |
| elemental real(double) function | jd2unix (jd) |
| Convert a Julian day (UT) to Unix time (seconds since 1970-01-01) | |
| elemental real(double) function | unix2jd (unixtime) |
| Convert UNIX time stamp to Julian day. | |
| subroutine | system_clock_2_ymdhms (year, month, day, hour, minute, second, ms, tz) |
| Return system-clock date and time in (year, month, ..., minute, second and tz) | |
Procedures for manipulation of date and time.
| elemental real(double) function sufr_date_and_time::cal2jd | ( | integer, intent(in) | yy, |
| integer, intent(in) | mm, | ||
| real(double), intent(in) | dd ) |
Convert a calendar date to JD. Input and output in UT.
| yy | The year (int) |
| mm | The month (int) |
| dd | The day (double) |
| cal2jd | The Julian day number (double) |
Definition at line 41 of file date_and_time.f90.
References cal2jd(), and sufr_kinds::double.
Referenced by cal2jd(), doy(), doy2md(), dtm2jd(), gps2jd(), jd2gps(), jd2year(), leapyr(), ymd2doy(), and ymdhms2jd().

| elemental subroutine sufr_date_and_time::consistent_date_time | ( | integer, intent(inout) | year, |
| integer, intent(inout) | month, | ||
| integer, intent(inout) | day, | ||
| integer, intent(inout) | hour, | ||
| integer, intent(inout) | minute, | ||
| real(double), intent(inout) | second ) |
Ensure date and time are consistent after manipulation (0<month<13, 0<=minute<60, etc.)
| year | Year CE (I/O) |
| month | Month of year (I/O) |
| day | Day of month (I/O) |
| hour | Hour of day (I/O) |
| minute | Minute (I/O) |
| second | Second (I/O) |
Definition at line 356 of file date_and_time.f90.
References sufr_kinds::double, jd2ymdhms(), and ymdhms2jd().

| elemental integer function sufr_date_and_time::dow_iso | ( | real(double), intent(in) | jd0 | ) |
Calculates ISO day of week (1 = Monday, ..., 7 = Sunday). Output for timezone of input - call dow_ut(jd+tz/24.d0) for local time.
| jd0 | Julian day number (double) |
| dow_iso | The day-of-week number, 1-7 for Mon-Sun (int) |
Definition at line 543 of file date_and_time.f90.
References sufr_kinds::double, dow_iso(), and dow_ut().
Referenced by dow_iso().

| elemental integer function sufr_date_and_time::dow_ut | ( | real(double), intent(in) | jd0 | ) |
Calculates day of week (0 = Sunday, ..., 6 = Saturday). Output for timezone of input - call dow_ut(jd+tz/24.d0) for local time.
| jd0 | Julian day number (double) |
| dow_ut | The day-of-week number, 0-6 for Sun-Sat (int) |
Definition at line 520 of file date_and_time.f90.
References sufr_kinds::double, and dow_ut().
Referenced by dow_iso(), dow_ut(), jd2rfc822(), and sufr_constants::set_sufr_constants_currentdate().

| elemental integer function sufr_date_and_time::doy | ( | real(double), intent(in) | jd0 | ) |
Calculate day of year (1-366) from JD.
| jd0 | Julian day |
| doy | The day of year (1-366) |
Definition at line 563 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, doy(), and jd2cal().
Referenced by doy(), and doy2md().

| elemental subroutine sufr_date_and_time::doy2md | ( | integer, intent(in) | doy, |
| integer, intent(in) | yr, | ||
| integer, intent(out) | mon, | ||
| integer, intent(out) | dy ) |
Calculate month and day from day of year and year.
| doy | Day of year number |
| yr | Year (CE) |
| mon | Month of year (output) |
| dy | Day of month (output) |
Definition at line 615 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, doy(), and jd2cal().

| elemental real(double) function sufr_date_and_time::dtm2jd | ( | integer, intent(in) | yy, |
| integer, intent(in) | mo, | ||
| integer, intent(in) | dd, | ||
| real(double), intent(in) | time ) |
Convert date and time (h) to a Julian day - input in UT.
| yy | Year (CE) |
| mo | Month |
| dd | Day of month |
| time | Time (hours) |
| dtm2jd | Julian day |
Definition at line 380 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, and dtm2jd().
Referenced by dtm2jd().

| real(double) function sufr_date_and_time::gps2jd | ( | real(double), intent(in) | gpstime | ) |
Convert a GPS time to Julian day (UT)
| GPStime | GPS time: seconds since 1980-01-06 |
| gps2jd | Julian day |
Definition at line 788 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, and gps2jd().
Referenced by gps2jd().

| elemental subroutine sufr_date_and_time::jd2cal | ( | real(double), intent(in) | jd, |
| integer, intent(out) | yy, | ||
| integer, intent(out) | mm, | ||
| real(double), intent(out) | dd ) |
Convert a Julian day to a calendar date (fractional day) - in UT.
| jd | Julian day (UT) |
| yy | Year (CE) (output) |
| mm | Month (output) |
| dd | Day of month (+ fraction) (output) |
Definition at line 89 of file date_and_time.f90.
References sufr_kinds::dbl, sufr_kinds::double, and sufr_kinds::long.
Referenced by doy(), doy2md(), jd2datestr(), jd2datetime(), jd2iso8601(), jd2rfc822(), jd2time(), jd2year(), and jd2ymdhms().
| elemental character function, dimension(15) sufr_date_and_time::jd2datestr | ( | real(double), intent(in) | jd | ) |
Convert a Julian day to a date string (yyyy-mm-dd)
| jd | Julian day (UT) |
| jd2datestr | The date as a string (yyyy-mm-dd) |
Definition at line 221 of file date_and_time.f90.
References sufr_kinds::double, jd2cal(), and jd2datestr().
Referenced by jd2datestr().

| elemental subroutine sufr_date_and_time::jd2datetime | ( | real(double), intent(in) | jd, |
| integer, intent(out) | year, | ||
| integer, intent(out) | month, | ||
| integer, intent(out) | day, | ||
| real(double), intent(out) | time ) |
Convert a Julian day to a date (y,m,d) and time (UT, h)
| jd | Julian day (UT). In order to obtain a local date and time, add TZ/24 to the JD. |
| year | Year CE (output) |
| month | Month of year (output) |
| day | Day of the month (output) |
| time | Time of day (hours) (output) |
Definition at line 295 of file date_and_time.f90.
References sufr_kinds::double, and jd2cal().

| real(double) function sufr_date_and_time::jd2gps | ( | real(double), intent(in) | jd | ) |
Convert a Julian day (UT) to a GPS time (seconds since 1980-01-06 - 2000-01-01 = 630720013.0)
| jd | Julian day (UT) |
| jd2gps | GPS time |
Definition at line 738 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, and jd2gps().
Referenced by jd2gps().

| elemental character function, dimension(30) sufr_date_and_time::jd2iso8601 | ( | real(double), intent(in) | jd, |
| real(double), intent(in), optional | tz ) |
Return JD as date and time in ISO_8601 format (e.g. 2014-03-24T20:48:01+00:00)
| jd | Julian day (UT) |
| tz | Time zone (optional - default: 0 = UT) |
| jd2iso8601 | Date string in ISO 8601 format. |
Definition at line 660 of file date_and_time.f90.
References sufr_kinds::double, jd2cal(), jd2iso8601(), tm2hm(), and tm2hms().
Referenced by jd2iso8601().

| elemental character function, dimension(35) sufr_date_and_time::jd2rfc822 | ( | real(double), intent(in) | jd, |
| real(double), intent(in), optional | tz ) |
Return JD as date and time in RFC-822 format (e.g. Sat, 07 Sep 2002 23:12:01 +0100)
| jd | Julian day (UT) |
| tz | Time zone (optional - default: 0 = UT) |
| jd2rfc822 | Date string in RFC-822 format |
Definition at line 696 of file date_and_time.f90.
References sufr_kinds::double, dow_ut(), jd2cal(), jd2rfc822(), tm2hm(), and tm2hms().
Referenced by jd2rfc822().

| elemental real(double) function sufr_date_and_time::jd2time | ( | real(double), intent(in) | jd | ) |
Convert a Julian day to time (UT, h)
| jd | Julian day (UT) |
| jd2time | Time in hours |
Definition at line 243 of file date_and_time.f90.
References sufr_kinds::double, jd2cal(), and jd2time().
Referenced by jd2time().

| elemental real(double) function sufr_date_and_time::jd2unix | ( | real(double), intent(in) | jd | ) |
Convert a Julian day (UT) to Unix time (seconds since 1970-01-01)
| jd | Julian day (UT) |
| jd2unix | UNIX time |
Definition at line 833 of file date_and_time.f90.
References sufr_kinds::double, and jd2unix().
Referenced by jd2unix().

| elemental real(double) function sufr_date_and_time::jd2year | ( | real(double), intent(in) | jd | ) |
Convert a Julian day to decimal year (e.g. 2000.0)
| jd | Julian day (UT) |
| jd2year | Decimal year CE |
Definition at line 265 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, jd2cal(), and jd2year().
Referenced by jd2year().

| elemental subroutine sufr_date_and_time::jd2ymdhms | ( | real(double), intent(in) | jd, |
| integer, intent(out) | yy, | ||
| integer, intent(out) | mm, | ||
| integer, intent(out) | d, | ||
| integer, intent(out) | h, | ||
| integer, intent(out) | m, | ||
| real(double), intent(out) | s ) |
Convert a Julian day to date and time (h,m,s, UT)
| jd | Julian day (UT) |
| yy | Year (CE, UT) (output) |
| mm | Month (UT) (output) |
| d | Day (UT) (output) |
| h | Hour (UT) (output) |
| m | Minute (UT) (output) |
| s | Second (+ fraction, UT) (output) |
Definition at line 185 of file date_and_time.f90.
References sufr_kinds::dbl, sufr_kinds::double, and jd2cal().
Referenced by consistent_date_time().

| elemental integer function sufr_date_and_time::leapyr | ( | integer, intent(in) | yr | ) |
Calculate whether year is leap (1) or not (0). The number of days in February is then given by 28 + leapyr(yr) and number of days in a year by 365 + leapyr(yr)
| yr | Year (CE) |
| leapyr | Leap year (1) or no (0) |
Definition at line 640 of file date_and_time.f90.
References cal2jd(), and leapyr().
Referenced by leapyr().

| subroutine sufr_date_and_time::system_clock_2_ymdhms | ( | integer, intent(out), optional | year, |
| integer, intent(out), optional | month, | ||
| integer, intent(out), optional | day, | ||
| integer, intent(out), optional | hour, | ||
| integer, intent(out), optional | minute, | ||
| real(double), intent(out), optional | second, | ||
| integer, intent(out), optional | ms, | ||
| real(double), intent(out), optional | tz ) |
Return system-clock date and time in (year, month, ..., minute, second and tz)
| year | Year CE (output) |
| month | Month of year (output) |
| day | Day of month (output) |
| hour | Hour of day (output) |
| minute | Minute (output) |
| second | Second (output) |
| ms | Millisecond (output) |
| tz | Time zone w.r.t. Greenwich in hours - >0 = east (output) |
Definition at line 881 of file date_and_time.f90.
References sufr_kinds::double, and sufr_dummy::dumstr99.
| elemental subroutine sufr_date_and_time::tm2hm | ( | real(double), intent(in) | tm, |
| integer, intent(out) | h, | ||
| integer, intent(out) | m ) |
Convert time (h) to hours and (integer) minutes.
| tm | Time (hours) |
| h | Hours (output) |
| m | Minutes (integer) (output) |
Definition at line 405 of file date_and_time.f90.
References sufr_kinds::double.
Referenced by jd2iso8601(), and jd2rfc822().
| elemental subroutine sufr_date_and_time::tm2hmm | ( | real(double), intent(in) | tm, |
| integer, intent(out) | h, | ||
| real(double), intent(out) | m ) |
Convert time (h) to hours and (decimal) minutes.
| tm | Time (hours) |
| h | Hours (output) |
| m | Minutes (decimal) (output) |
Definition at line 432 of file date_and_time.f90.
References sufr_kinds::double.
| elemental subroutine sufr_date_and_time::tm2hms | ( | real(double), intent(in) | tm, |
| integer, intent(out) | h, | ||
| integer, intent(out) | m, | ||
| integer, intent(out) | s ) |
Convert time (h) to hours, minutes and (integer) seconds.
| tm | Time (hours) |
| h | Hours (output) |
| m | Minutes (output) |
| s | Seconds (integer) (output) |
Definition at line 457 of file date_and_time.f90.
References sufr_kinds::double.
Referenced by jd2iso8601(), and jd2rfc822().
| elemental subroutine sufr_date_and_time::tm2hmss | ( | real(double), intent(in) | tm, |
| integer, intent(out) | h, | ||
| integer, intent(out) | m, | ||
| real(double), intent(out) | s ) |
Convert time (h) to hours, minutes and (decimal) seconds.
| tm | Time (hours) |
| h | Hours (output) |
| m | Minutes (output) |
| s | Seconds (output) |
Definition at line 491 of file date_and_time.f90.
References sufr_kinds::double.
| elemental real(double) function sufr_date_and_time::unix2jd | ( | real(double), intent(in) | unixtime | ) |
Convert UNIX time stamp to Julian day.
| unixTime | Unix time: 0 = JD 2440587.5 = 1970-01-01 |
| unix2jd | Julian day |
Definition at line 853 of file date_and_time.f90.
References sufr_kinds::double, and unix2jd().
Referenced by unix2jd().

| elemental real(double) function sufr_date_and_time::year2jd | ( | real(double), intent(in) | year | ) |
Convert a year (with decimals) to a JD. Input and output in UT.
| year | The year |
| year2jd | The Julian day number |
Definition at line 149 of file date_and_time.f90.
References sufr_kinds::double, and year2jd().
Referenced by year2jd().

| elemental integer function sufr_date_and_time::ymd2doy | ( | integer, intent(in) | yr, |
| integer, intent(in) | mon, | ||
| integer, intent(in) | dy ) |
Calculate day of year (1-366) from year,month,day.
| yr | Year (CE) |
| mon | Month |
| dy | Day of month |
| ymd2doy | Day of year (1-366) |
Definition at line 588 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, and ymd2doy().
Referenced by ymd2doy().

| elemental real(double) function sufr_date_and_time::ymdhms2jd | ( | integer, intent(in) | yy, |
| integer, intent(in) | mmo, | ||
| integer, intent(in) | dd, | ||
| integer, intent(in) | h, | ||
| integer, intent(in) | m, | ||
| real(double), intent(in) | s ) |
Convert date and time (y,m,d, h,m,s) to JD. Input and output in UT.
| yy | The year (int) |
| mmo | The month (int) |
| dd | The day (int) |
| h | The hour (int) |
| m | The minute (int) |
| s | The second (double) |
| ymdhms2jd | The Julian day number (double) |
Definition at line 325 of file date_and_time.f90.
References cal2jd(), sufr_kinds::double, and ymdhms2jd().
Referenced by consistent_date_time(), sufr_constants::set_sufr_constants_currentdate(), sufr_system::timestamp(), and ymdhms2jd().
