dow(3f) - [M_time:DAY_OF_WEEK] given a date-time array DAT return the day of the week (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
subroutine dow(values, weekday, day, ierr, short)
integer,intent(in) :: values(8) integer,intent(out),optional :: weekday character(len=*),intent(out),optional :: day integer,intent(out),optional :: ierr logical,intent(in),optional :: short
Given a date array DAT return the day of the week as a number and a name, Mon=1.
values "DAT" array (an integer array of the same format as the array returned by the intrinsic DATE_AND_TIME(3f)) describing the date to be used to calculate the day of the week. dat=[ year,month,day,timezone,hour,& & minutes,seconds,milliseconds]
weekday The numeric day of the week, starting with Monday=1. Optional. day The name of the day of the week. Optional. ierr Error code If the error code is not returned and an error occurs, the program is stopped.
o [ 0] correct o [-1] invalid input date o [-2] neither day nor weekday return values were requested.
Sample program:
program demo_dow use M_time, only : dow implicit none integer :: dat(8) ! input date array integer :: weekday character(len=9) :: day integer :: ierr call date_and_time(values=dat) call dow(dat, weekday, day, ierr) write(*,’(a,i0)’)’weekday=’,weekday write(*,’(a,a)’)’day=’,trim(day) write(*,’(a,i0)’)’ierr=’,ierr end program demo_dowresults:
weekday=1 day=Monday ierr=0
John S. Urban, 2015-12-19
Nemo Release 3.1 | dow (3) | February 23, 2025 |