Lingo Dictionary > D-F > date() (formats) |  |

date() (formats)

Syntax

    date(ISOFormatString)
    date(ISOFormatInteger)
    date(ISOFormatIntegerYear, ISOFormatIntegerMonth, ISOFormatIntegerDay)

Description

Function and data type; creates a standard, formatted date object instance for use with other date object instances in arithmetic operations and for use in manipulating dates across platforms and in international formats.

When creating the date, use four digits for the year, two digits for the month, and two digits for the day. The following expressions are equivalent:

`integer:` | `set vacationStart = date(19980618)`
`string:` | `set vacationStart = date("19980618")`
`comma separated:` | `set vacationStart = date(1998, 06, 18)`

Addition and subtraction operations on the date are interpreted as the addition and subtraction of days.

The individual properties of the date object instance returned are:

`#year` | `Integer representing the year`
`#month` | `Integer representing the month of the year`
`#day` | `Integer representing the day of the month`

Example

These statements create and determine the number of days between two dates:

    myBirthDay = date(19650712)
    yourBirthDay = date(19450529)
    put "There are" && abs(yourBirthday - myBirthday) && "days between our birthdays."

Example

These statements access an individual property of a date:

    myBirthDay = date(19650712)
    put "I was born in month number"&&myBirthday.month

See also

`date() (system clock)`