classAnova - Knowledge Shared

Posted by: Bob Cozzi
IT Researcher
Cozzi Productions, Inc.
North Aurora, IL
RPG Open - Documentation Group
has no ratings.
Published: 08 Feb 2011
Revised: 04 Aug 2011 - 4024 days ago
Last viewed on: 10 Aug 2022 (4508 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Get Day of Week Published by: Bob Cozzi on 08 Feb 2011 view comments

RPG Open

GetDayOfWeek - Get Day of Week from Date

Syntax Diagram

day = getDayOfWeek( [ date ] );

The getDayOfWeek subprocedure returns the day of the week as 1 to 7 (1=Sunday, 2=Monday, etc.) for the given date.

If no date is specified for the first parameter, the current system date is used and its day is returned.

            today = getDayOfWeek();  // Return today's day of week
            yesterday = getDayOfWeek(%date() - %days(1));  // What was yesterday?
            shipOn = getDayOfWeek(shipDate);  // On which day did the order Ship?

Valid date fields or the %DATE built-in function may be specified for the date parameter. If no date parameter is specified, then the current system date is used.

Return to

Return to home page.
Sort Ascend | Descend