Standard date and time functions are for use with non-legacy dates. For a definition of standard dates and times, see Date and Time Functions.
How to: |
The HHMMSS function retrieves the current time from the operating system as an 8-character string, separating the hours, minutes, and seconds with periods.
To use this function, you must import the function library MNTUWS. For information on importing a function library, see Calling a Function.
There is also an HHMMSS function available in the reporting language. For information on this function, see HHMMSS: Retrieving the Current Time.
HHMMSS()
HHMMSS retrieves the current time from the operating system:
MAINTAIN Module Import (mntuws); Case Top Compute now/a10 = hhmmss(); type "Now = <<now" EndCase END
The output is:
Now = 14.25.33
How to: |
The Initial_HHMMSS function returns the time when the Maintain Data application was started as an 8-character string, with embedded periods separating the hours, minutes, and seconds.
To use this function, you must import the function library MNTUWS. For details on importing this library, see Calling a Function.
Initial_HHMMSS()
How to: |
The Initial_TODAY function returns the date in MM/DD/YY format when the Maintain Data application was started as an 8-character string with embedded slashes.
To use this function, you must import the function library MNTUWS. For details on importing this library, see Calling a Function.
Initial_TODAY()
How to: |
The TODAY function retrieves the current date from the system in the format MM/DD/YY. TODAY always returns a date that is current. Therefore, if you are running an application late at night, use TODAY. You can remove the embedded slashes using the EDIT function.
To use this function, you must import the function library MNTUWS. For information on importing this library, see Calling a Function.
There is a version of the TODAY function that is available only in the reporting language. For information on this function, see HTMTOTS or TIMETOTS: Converting a Time to a Timestamp.
TODAY()
TODAY retrieves the current date from the system:
MAINTAIN Module Import (mntuws); Case Top Compute date1/a8 = today(); type "Date1 = <<date1" Endcase END
The result is:
Date1 = 07/17/02
How to: |
The TODAY2 function retrieves the current date from the operating system in the format MM/DD/YYYY. Use format A10 with the TODAY2 function to ensure proper results.
To use this function, you must import the function library MNTUWS. For information on importing this library, see Calling a Function.
TODAY2()
TODAY2 retrieves the current date from the system:
MAINTAIN Module Import (mntuws); Case Top Compute date2/a10 = today2(); type "Date2 = <<date2" Endcase END
The result is:
Date2 = 07/17/2002
How to: |
The ADD function adds a given number of days to a date.
ADD(date,value)
or
date.ADD(value)
where:
This function changes the value of date.
ADD adds 10 days to the each value in the DateVar field:
ADD(DateVar, 10)
The following are sample values for DateVar and the corresponding values for ADD(DateVar, 10):
DateVar ADD(DateVar, 10); ------- ----------------- 12/31/1999 01/10/2000 01/01/2000 01/11/2000 01/02/2000 01/12/2000
How to: |
The DAY function extracts the day of the month from a date and returns the result as an integer.
DAY(date);
where:
DAY extracts the day of the month from the DATE field:
DAY(DATE)
The following are sample values for DATE and the corresponding values for DAY(DATE):
DATE DAY(DATE) ---- --------- 01/01/2000 1 01/02/2000 2 01/03/2000 3
How to: |
The JULIAN function determines the number of days that have elapsed in the given year up to a given date, and returns the result as an integer.
JULIAN(date);
where:
JULIAN determines the number of days that have elapsed up to the date in the DATE field:
JULIAN(DATE)
The following are sample values for DATE and the corresponding values for JULIAN(DATE):
DATE JULIAN(DATE) ---- ------------ 01/01/2000 1 02/01/2000 32 03/01/2000 61
How to: |
The MONTH function extracts the month from a date and returns the result as an integer.
MONTH(date);
where:
MONTH extracts the month from each value in the DATE field:
MONTH(DATE)
The following are sample values for DATE and the corresponding values for MONTH(DATE):
DATE MONTH(DATE) ---- ----------- 01/01/2000 1 02/01/2000 2 03/01/2000 3
How to: |
The QUARTER function determines the quarter of the year in which a date resides, and returns the result as an integer.
QUARTER(date);
where:
QUARTER extracts the quarter component from each value in the DATE field:
QUARTER(DATE)
The following are sample values for DATE and the corresponding values for QUARTER(DATE):
DATE QUARTER(DATE) ---- ------------- 01/01/2000 1 04/01/2000 2 07/01/2000 3
How to: |
The SETMDY function sets a value to a date based on numeric values representing a day, month, and year. SETMDY returns a 0 if the function is successful, and a negative number if the function fails.
SETMDY(date, month, day, year);
or
date.SETMDY(month, day, year);
where:
SETMDY sets the value of DateVar, which is formatted as a date that appears as wrMtrDYY (for example, Saturday, January 1, 2000):
SETMDY(DateVar, month, day, year);
The following are sample values for month, day, and year, and the corresponding dates for DateVar:
month day year DateVar ----- --- ---- ------- 04 05 1965 Monday, April 5, 1965 02 01 1997 Saturday, February 1, 1997 01 01 2000 Saturday, January 1, 2000
How to: |
The SUB function subtracts a given number of days from a date.
SUB(date,value)
or
date.SUB(value)
where:
SUB subtracts 10 days from each value in the DateVar field.
SUB(DateVar, 10)
The following are sample values for DateVar and the corresponding values for SUB(DateVar, 10):
DateVar SUB(DateVar, 10); ------- ----------------- 12/31/1999 12/21/2000 01/01/2000 12/22/2000 01/02/2000 12/23/2000
How to: |
The WEEKDAY function determines the day of the week for a date and returns the result as an integer (1=Monday, 2=Tuesday, and so on).
WEEKDAY(date);
where:
WEEKDAY determines the day of the week for each date in the DATE field, and stores that day as a number corresponding to a weekday:
WEEKDAY(DATE)
The following are sample values for DATE and the corresponding values for WEEKDAY(DATE):
DATE WEEKDAY(DATE) ---- ------------- 01/01/2000 6 01/02/2000 7 01/03/2000 1
How to: |
The YEAR function extracts the year from a date.
YEAR(date);
where:
YEAR extracts the year from the DATE field, and stores that year in the YEAR(DATE) field:
YEAR(DATE)
The following are sample values for DATE and the corresponding values for YEAR(DATE):
DATE YEAR(DATE) ---- ---------- 01/01/2000 2000 02/01/2001 2001 03/01/2002 2002