toString Method

Class: Date

Description

This method returns a Date object in a particular date format.

Syntax

dateObject.toString(String format)

Parameters

format

The format in which to display the date. The default is MM/DD/YEAR.

Valid format codes include:

 

DD

The day of the month as two digits.

 

MM

The month as two digits.

 

YY

The year as two digits.

 

YEAR

The year as four digits.

 

MON

The first three characters of the English name of the month.

 

DAY

The first three characters of the English name of the day in the week.

 

punctuation characters

Any of the following punctuation characters:

  • space

  • comma (,)

  • period (.)

  • slash (/)

  • colon (:)

  • semicolon (;)

  • asterisk (*)

  • plus sign (+)

  • minus sign (-)

Example: YEAR-MM-DD

Returns

A formatted string representing the Date object.

When Became Available

Profile v7.0

Example

type RecordCIF cif = Db.getRecord("CIF","ACN=:ACN")

type Date date = cif.dob        // declare Date object

 

// Translate into ISO format

type String dobISO = date.toString("YEAR-MM-DD")

 

* Variable ACN must be defined prior to the getRecord statement.