Foundation 6

Fnd_Date

17 shared methods.

Fnd_Date_Calendar

Fnd_Date_Calendar (->date field or variable) -> bOK

Displays a small calendar window and allows the user to select a date. Modifies the passed parameter.

returns the bOK variable to 1 if a date is selected.

ParameterTypeDirectionDescription
dateFieldVariablePointerinA date field or variable
ResultBooleanoutTrue = (OK=1)

Fnd_Date_CalendarSetDate

Fnd_Date_CalendarSetDate (function; operator)

Sets the date as per the string parameters function and operator, and redraws the calendar grid to match. Reads and writes the running form's Form object, so it is of no use outside Fnd_Date_CalendarPopup.

Functions: "date" "var" - Sets the date to the date already on Form.date "today" - Sets the date to today Date String - Sets the date to the date passed as a string "calendar" Pass the day number as a string to set the date "year", "month" & "day" Pass "+n" or "-n" to add or subtract n number of years, months or days

ParameterTypeDirectionDescription
functionTextinThe function to perform
operatorTextinAdditional information

Fnd_Date_DateAndTimeToISO

Fnd_Date_DateAndTimeToISO (date{; time}) --> Text

Returns an ISO 8601 formatted date or date-time value.

If only a date is supplied, a calendar date is returned: YYYY-MM-DD If both date and time are supplied, a date-time value is returned: YYYY-MM-DDThh:mm:ss If both are passed but the date is !00/00/00! then only the time is returned: hh:mm:ss

For more information: <http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html>

ParameterTypeDirectionDescription
dateDateinA date
inTimeTimeinA time (optional)
ResultTextoutThe date-time stamp

Fnd_Date_DateToString

Fnd_Date_DateToString (date{; relative to date{; format}}) --> Text

Returns a blank string if the date = !00/00/00! Returns "Today", "Tomorrow", or "Yesterday" if appropriate. This is localized if the Localization component is available.

Otherwise returns a short date string.

ParameterTypeDirectionDescription
inputDateinThe date to convert to a string
inRelativeToDateinThe relative date (optional)
inDateFormatTextinThe date format (eg. "M/D/Y") (optional)
ResultTextoutThe date as a string

Fnd_Date_EndOfMonth

Fnd_Date_EndOfMonth (date) --> Date

Returns the last day of the month passed.

ParameterTypeDirectionDescription
inTheDateinAny date
ResultDateoutThe last day of the month for the date

Fnd_Date_EntryFilter

Fnd_Date_EntryFilter (->date field or variable)

Interprets what has been entered as a date And checks to see if a "function" key is hit and acts accordingly

Place in the object method of a date field or variable: Fnd_Date_EntryFilter(Self)

Required: Enable the field's On Before Keystroke and On Data Change events.

ParameterTypeDirectionDescription
dateFieldPointerinThe date entry field

Fnd_Date_Info

Fnd_Date_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

Method Type: Protected

ParameterTypeDirectionDescription
requestTextinInfo desired ("version" or "name")
ResultTextoutResponse

Fnd_Date_ISOtoDate

Fnd_Date_ISOtoDate (date string) --> Date

Retrieves the date value from an ISO 8601 formatted date. The input can be in either of these formats: YYYY-MM-DD YYYY-MM-DDThh:mm:ss

ParameterTypeDirectionDescription
isoDateTextinAn ISO format date
ResultDateoutThe date

Fnd_Date_ISOtoTime

Fnd_Date_ISOtoTime (date-time string) --> Time

Retrieves the time value from an ISO 8601 formatted date-time string. The input must be in the YYYY-MM-DDThh:mm:ss or hh:mm:ss format.

ParameterTypeDirectionDescription
inIsoDateTimeTextinAn ISO format date-time or time string
ResultDateoutThe time

Fnd_Date_LocalTimestamp

Fnd_Date_LocalTimestamp --> Text

Returns the current local date and time as an ISO 8601 style stamp with milliseconds: YYYY-MM-DDThh:mm:ss.mmm

4D's Timestamp command returns the same instant in UTC, with a trailing Z. This returns local wall-clock time instead, which is what a developer reading a log or a result file expects to see.

Note there is deliberately no offset suffix, so the result is not a complete ISO 8601 instant. Stamps produced by this method are comparable with each other, not with a UTC stamp. Do not mix the two in one payload.

ParameterTypeDirectionDescription
ResultTextoutLocal timestamp, YYYY-MM-DDThh:mm:ss.mmm

Fnd_Date_MonthName

Fnd_Date_MonthName (month number) --> Text

Returns the name of the month with the specified number.

This routine will use Foundation's Localization routine, if it's available, to return the localized month name. If the Fnd_Loc component is not available, the name will be localized using 4D's language.

ParameterTypeDirectionDescription
monthNumLongintin1 thorugh 12
ResultTextoutThe name of the month

Fnd_Date_RoundTime

Fnd_Date_RoundTime (time{; option}) --> Time

Rounds the time.

The option parameter determines the rounding style: 1 : Round up or down to the nearest quarter hour 2 : Round down to the nearest quarter hour

ParameterTypeDirectionDescription
inTimeTimeinThe time to round
inOptionTimeinThe rounding style (optional)
ResultTimeoutThe rounded time

Fnd_Date_RoundTimeDown

Fnd_Date_RoundTimeDown (time) --> Time

Rounds the time down to the nearest quarter hour.

ParameterTypeDirectionDescription
inTimeTimeinThe time to round
ResultTimeoutThe rounded time

Fnd_Date_RoundTimeNear

Fnd_Date_RoundTimeNear (time) --> Time

Rounds to the quarter hour. If the time passed in is up to ten minutes after the quarter hour, the time is rounded down. Otherwise it's rounded up. Won't round up past 23:59.

ParameterTypeDirectionDescription
inTimeTimeinThe time to round
ResultTimeoutThe rounded time

Fnd_Date_StringToDate

Fnd_Date_StringToDate (date as text{; date format}) --> Date

Returns the date equivalent of the string passed.

This works for M/D/Y, D/M/Y, Y/M/D and Y/D/M style dates. It will not work for any date with the Y in the middle (does anyone do that?).

Two digit years are resolved as per the SET DEFAULT CENTURY command.

Dates can be enter with any character as a delimiter.

If no year is entered, the current year is assumed.

If only a one or two digit number is entered, the current month is assumed.

If no delimiter is used, the following formats are supported (M/D/Y format): 070476 Returns a date of 07/04/76 07041976 Returns a date of 07/04/1976 0704 Returns 07/04/00 (If this is in fact the year 2000) 04 or 4 Returns the 4th day of the current month 74, 704 and 074 are not supported. "Today" returns the $today_date. "Yesterday" returns the $today_date -1. "Tomorrow" returns the $today_date +1.

ParameterTypeDirectionDescription
inInputTextinA text representation of a date
inDateFormatTextinThe assumed date format, such as "M/D/Y" (optional)
ResultDateoutThe date

Fnd_Date_SystemDateFormat

Fnd_Date_SystemDateFormat --> Text

Returns a string that can be used in If and Case statements to test the current system's date format. It will return Y, M, and D based in a format like this: "M/D/Y" = Month/Day/Year "D/M/Y" = Day/Month/Year

ParameterTypeDirectionDescription
ResultTextoutThe date format

Fnd_Date_YearMonthDayToDate

Fnd_Date_YearMonthDayToDate (year; month; day) --> Date

Converts the year, month, and day into a 4D date.

Works with either a two or four digit year.

Works regardless of the system's date format or the default century setting.

Out of range parts roll over rather than being refused, which is deliberate:

month 13 gives January of the next year, day 0 gives the last day of the previous month, and 31 February gives 3 March. Programmatic callers rely on this — Fnd_Date_EndOfMonth is day 0 of the following month. Pass through Fnd_Date_StringToDate instead when the input came from a person, since that one refuses a month above 12 or a day above 31.

ParameterTypeDirectionDescription
inYearLongintinYear (2 or 4 digits)
monthLongintinMonth
dayLongintinDay
ResultDateoutThe date