MoneyWorks Manual
DateToText (date, [format])
Result Type: Text
Definition: Converts the supplied date to text in the requested format. Format is a name or value from the table below—the sample output shown is for the 31st January 2016 with the date format in the system settings being "dd/mm/yy".
Name | Value | Sample Output |
---|---|---|
DateFormShort | 0 | 31/01/16 |
DateFormLong | 1 | Sunday, 31 January 2016 |
DateFormAbbrev | 2 | 31 January 2016 |
DateFormLongDateAndTime | -1 | Sunday, 31 January 2016 12:00:00 am |
DateFormAbbrevDateAndTime | -2 | 31 January 2016 12:00:00 am |
DateFormShortDateAndTime | -3 | 31/01/16 12:00:00 am |
DateFormTimeOnly | -4 | 12:00:00 am |
DateFormTimeOnlyNoSecs | -5 | 12:00 am |
The following formats are not affected by your system settings | ||
DateFormDDMMYYHHMMSSTT | -6 | 31/1/2016 12:00:00 A |
DateFormDDMMYY | 3 | 31/1/2016 |
DateFormYYYYMMDD | -8 | 20160131 |
DateFormYYYYMMDDHHMMSS | -7 | 20160131000000 |
DateFormISO | -9 | 2016-01-31 |
In v9.1 and later, the format parameter may be a POSIX strftime
format string. Note that Mac and Windows have differing support for strftime format specifiers.
Examples: DateToText('21/2/68')
returns 21/2/68 (but the format may differ depending on the calculation box format).
DateToText('21/2/68', 0)
or DateToText('21/2/68', DateFormShort)
returns 21/2/68.
DateToText('21/2/68', 1)
or DateToText('21/2/68', DateFormLong)
gives Wednesday, 21 February, 1968.
DateToText('21/2/68', 2)
or DateToText('21/2/68', DateFormAbbrev)
returns Wed, Feb 21, 1968
DateToText('21/2/68', "%Y-%B-%d")
In v9.1 and later, returns 1968-February-21 (depending on platform's locale)
See Also:
CalcDueDate: Calculate a due date for given terms
CurrentPeriod: Get the current period number
Date: Convert d,m,y to a date
DateToPeriod: Convert a date to a period
Day: Get the Day of month of a date
DayOfWeek: Get The weekday of a date
FirstUnlockedPeriod: Get the oldest period that is not locked
Month: Get the month of a date
PeriodName: Get the Name of a period
PeriodOffset: Difference between two periods
PeriodToDate: Get the end date of a period
TextToDate: Parse a string to a date
Time: The current Datetime
TimeAdd: Add seconds to a DateTime
TimeDiff: The difference, in seconds, between two DateTimes
Timestamp: A timestamp string
Today: Today's date
WeekOfYear: Convert a date to a week number
Year: Year of a date