Date functions

Description: Two new date functions to calculate the week number of a given date and Age as date duration are added.
  • WEEKNUM function converts a given Julian/Gregorian date to number of week. There are 2 versions of this function, the standard USA format and the ISO format.
  • WEEKNUM=USA function returns an integer in the range of 1 to 54 that represents the week of the year. The week starts with Sunday, and January 1 is always in the first week.
  • WEEKNUM=ISO function returns an integer in the range of 1 to 53 that represents the week of the year. The week starts with Monday and includes 7 days. Week 1 is the first week of the year to contain a Thursday, which is equivalent to the first week containing January 4.
  • AGE function returns a date duration that specifies the number of years, months, and days between an input date and current date.
  • Age=YMD produces an 8-byte result which has duration in years (0-9999), months (00-12), and days (00-31).
  • Age=YM produces a 6-byte result which has duration in years (0-9999), months (00-12).
  • Age=YD produces a 7-byte result which has duration in years (0-9999), days (00-366).

When change was introduced: z/OS® V2R2

Reference information: z/OS DFSORT Application Programming Guide