C Library Functions - dow (3)
NAME
dow(3f) - [M_time:DAY_OF_WEEK] given a date-time array DAT return
the day of the week
(LICENSE:MIT)
CONTENTS
Synopsis
Description
Options
Returns
Example
Author
License
SYNOPSIS
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
DESCRIPTION
Given a date array DAT
return the day of the week as a number and a name, Mon=1.
OPTIONS
|
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]
RETURNS
|
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
|
|
o
|
[ 0] correct
|
|
o
|
[-1] invalid input date
|
|
o
|
[-2] neither day nor weekday
return values were requested.
|
|
If the error code is not returned and an error occurs,
the program is stopped.
|
|
EXAMPLE
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_dow
results:
weekday=1
day=Monday
ierr=0
AUTHOR
John S. Urban, 2015-12-19
LICENSE
MIT
| Nemo Release 3.1 | dow (3) | June 29, 2025 |
Generated by manServer 1.08 from 7031b67e-721e-4b74-b819-19393895d8df using man macros.