ymd-weekday

function

Library: Date and time functions (OMDATE)
Include: omdate.xin

Returns: Returns the number of the day of the week.


Declaration
define integer function 
   ymd-weekday of value string ymd

Argument definitions

ymd
is the date in YYYYMMDD format


Purpose

ymd-weekday takes a date in YYYYMMDD format and returns a numerical representation of the day of the corresponding day of the week; Monday is day 1 and Sunday is day 7.

Example

The following example outputs the numerical representation of the day of the week for the current date.

  include "omdate.xin"
  
  process
     output "Today now-as-ymdhms = " || now-as-ymdhms || "%n"
         || "Today is a day number " || "d" % ymd-weekday of now-as-ymdhms || "%n"
The output of this program might be
  Today now-as-ymdhms = 20191031163322-0400
  Today is a day number 4

Usage Note

To use ymd-weekday, you must include the following code near the top of your program:

  include "omdate.xin"