Progress
Language Reference


DAY Function

Interfaces
OS
SpeedScript
All
All
Yes

Converts a date to a day of the month integer value from 1 to 31, inclusive.

SYNTAX

DAY ( date ) 

date

An expression whose value is a date.

EXAMPLE

This procedure determines the date one year from a given date, allowing for leap years. You could simply determine a date 365 days later by adding 365 to the d1 variable, but that might not produce the correct result (for example, 1/1/92 + 365 days is 12/31/92).

r-day.p
DEFINE VARIABLE d1 AS DATE LABEL "Date".
DEFINE VARIABLE d2 AS DATE LABEL "Same date next year".
DEFINE VARIABLE d-day AS INTEGER.
DEFINE VARIABLE d-mon AS INTEGER.

REPEAT:
  SET d1.
  d-day = DAY(d1).
  d-mon = MONTH(d1).
  IF d-mon = 2 AND d-day = 29 THEN d-day = 28.
  d2 = DATE(d-mon,d-day,YEAR(d1) + 1).
  DISPLAY d2.
END. 

SEE ALSO

DATE Function, MONTH Function, TODAY Function, WEEKDAY Function, YEAR Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095