Edit

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".

NameValueSample Output
DateFormShort031/01/16
DateFormLong1Sunday, 31 January 2016
DateFormAbbrev231 January 2016
DateFormLongDateAndTime-1Sunday, 31 January 2016 12:00:00 am
DateFormAbbrevDateAndTime-231 January 2016 12:00:00 am
DateFormShortDateAndTime-331/01/16 12:00:00 am
DateFormTimeOnly-412:00:00 am
DateFormTimeOnlyNoSecs-512:00 am
The following formats are not affected by your system settings
DateFormDDMMYYHHMMSSTT-631/1/2016 12:00:00 A
DateFormDDMMYY331/1/2016
DateFormYYYYMMDD-820160131
DateFormYYYYMMDDHHMMSS-720160131000000
DateFormISO-92016-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