githubEdit

datetime

The primary DateTime class that represents a date and time object in BoxLang

All temporal methods in BoxLang operate on this class and all castable date/time representations are cast to this class

Datetime Methods

chevron-rightadd(datepart=[string], number=[number])hashtag

Modifies a date object by date part and integer time unit

Arguments:

Argument
Type
Required
Default

datepart

string

true

null

number

number

true

null

chevron-rightbxDump(label=[string], top=[numeric], expand=[boolean], abort=[boolean], output=[string], format=[string], showUDFs=[boolean])hashtag

Outputs the contents of a variable (simple or complex) of any type for debugging purposes to a specific output location.

, The available ,,output,, locations are: - ,,buffer,,: The output is written to the buffer, which is the default location. If running on a web server, the output is written to the browser. - ,,console,,: The output is printed to the System console. - ,,Absolute File Path,, The output is written to a file with the specified absolute file path. ,

,

The output format can be either HTML or plain text.

The default format is HTML if the output location is the buffer or a web server or a file, otherwise it is plain text for the console.

Arguments:

Argument
Type
Required
Default

label

string

false

null

top

numeric

false

null

expand

boolean

false

true

abort

boolean

false

false

output

string

false

null

format

string

false

null

showUDFs

boolean

false

true

chevron-rightclone()hashtag

chevron-rightcompare(date2=[any], datepart=[string])hashtag

Compares the difference between two dates - returning 0 if equal, -1 if date2 is less than date1 and 1 if the inverse

Arguments:

Argument
Type
Required
Default

date2

any

true

null

datepart

string

false

null

chevron-rightcompareTo(date2=[any], datepart=[string])hashtag

Compares the difference between two dates - returning 0 if equal, -1 if date2 is less than date1 and 1 if the inverse

Arguments:

Argument
Type
Required
Default

date2

any

true

null

datepart

string

false

null

chevron-rightdateFormat(mask=[string], timezone=[string], locale=[string])hashtag

Formats a datetime, date or time

Arguments:

Argument
Type
Required
Default

mask

string

false

null

timezone

string

false

null

locale

string

false

null

chevron-rightdateTimeFormat(mask=[string], timezone=[string], locale=[string])hashtag

Formats a datetime, date or time

Arguments:

Argument
Type
Required
Default

mask

string

false

null

timezone

string

false

null

locale

string

false

null

chevron-rightday(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdayOfWeek(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdayOfWeekAsString(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdayOfWeekShortAsString(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdayOfYear(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdaysInMonth(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdaysInYear(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightdiff(datepart=[string], date2=[any])hashtag

Returns the numeric difference in the requested date part between two dates

Arguments:

Argument
Type
Required
Default

datepart

string

true

null

date2

any

true

null

chevron-rightduplicate(deep=[boolean])hashtag

Duplicates an object - either shallow or deep

Arguments:

Argument
Type
Required
Default

deep

boolean

false

true

chevron-rightequals(obj=[any])hashtag

Indicates whether some other object is "equal to" this one.

Arguments:

Argument
Type
Required
Default

obj

any

true

null

chevron-rightfirstDayOfMonth(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightformat(mask=[string], timezone=[string], locale=[string])hashtag

Formats a datetime, date or time

Arguments:

Argument
Type
Required
Default

mask

string

false

null

timezone

string

false

null

locale

string

false

null

chevron-rightgetnumericdate(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightgetTime()hashtag

Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

chevron-righthash(algorithm=[string], encoding=[string], numIterations=[integer])hashtag

Creates an algorithmic hash of an object

Arguments:

Argument
Type
Required
Default

algorithm

string

false

MD5

encoding

string

false

utf-8

numIterations

integer

false

1

chevron-righthour(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightlen()hashtag

Returns the absolute value of a number

chevron-rightmillisecond(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightminute(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightmonth(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightmonthAsString(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightmonthShortAsString(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightnanosecond(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightoffset(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightquarter(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightsecond(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-righttimeFormat(mask=[string], timezone=[string], locale=[string])hashtag

Formats a datetime, date or time

Arguments:

Argument
Type
Required
Default

mask

string

false

null

timezone

string

false

null

locale

string

false

null

chevron-righttimezone(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-righttoEpoch()hashtag

Returns this date time in epoch time ( seconds )

chevron-righttoEpochMillis()hashtag

Returns this date time in epoch milliseconds

chevron-righttoEpochSecond()hashtag

chevron-righttoISOString()hashtag

Returns the date time representation as a string in the specified format mask

chevron-righttoODBCDate(timezone=[string])hashtag

Creates a DateTime object with the format set to ODBC Implicit format

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

chevron-righttoODBCDateTime(timezone=[string])hashtag

Creates a DateTime object with the format set to ODBC Implicit format

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

chevron-righttoODBCTime(timezone=[string])hashtag

Creates a DateTime object with the format set to ODBC Implicit format

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

chevron-rightweek(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

chevron-rightyear(timezone=[string], locale=[string])hashtag

Provides the BIF and member functions for all time unit request with no arguments

Arguments:

Argument
Type
Required
Default

timezone

string

false

null

locale

string

false

null

Examples

Last updated

Was this helpful?