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
add(datepart=[string], number=[number])
Modifies a date object by date part and integer time unit
Arguments:
datepart
string
true
null
number
number
true
null
compare(date2=[any], datepart=[string])
Compares the difference between two dates - returning 0 if equal, -1 if date2 is less than date1 and 1 if the inverse
Arguments:
date2
any
true
null
datepart
string
false
null
compareTo(date2=[any], datepart=[string])
Compares the difference between two dates - returning 0 if equal, -1 if date2 is less than date1 and 1 if the inverse
Arguments:
date2
any
true
null
datepart
string
false
null
dateFormat(mask=[string], timezone=[string], locale=[string])
Formats a datetime, date or time
Arguments:
mask
string
false
null
timezone
string
false
null
locale
string
false
null
dateTimeFormat(mask=[string], timezone=[string], locale=[string])
Formats a datetime, date or time
Arguments:
mask
string
false
null
timezone
string
false
null
locale
string
false
null
day(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
dayOfWeek(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
dayOfWeekAsString(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
dayOfWeekShortAsString(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
dayOfYear(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
daysInMonth(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
daysInYear(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
diff(datepart=[string], date2=[any])
Returns the numeric difference in the requested date part between two dates
Arguments:
datepart
string
true
null
date2
any
true
null
duplicate(deep=[boolean])
Duplicates an object - either shallow or deep
Arguments:
deep
boolean
false
true
equals(obj=[any])
Indicates whether some other object is "equal to" this one.
Arguments:
obj
any
true
null
firstDayOfMonth(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
format(mask=[string], timezone=[string], locale=[string])
Formats a datetime, date or time
Arguments:
mask
string
false
null
timezone
string
false
null
locale
string
false
null
getnumericdate(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
getTime(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
hash(algorithm=[string], encoding=[string], numIterations=[integer])
Creates an algorithmic hash of an object
Arguments:
algorithm
string
false
MD5
encoding
string
false
utf-8
numIterations
integer
false
1
hour(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
millisecond(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
minute(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
month(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
monthAsString(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
monthShortAsString(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
nanosecond(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
offset(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
quarter(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
second(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
timeFormat(mask=[string], timezone=[string], locale=[string])
Formats a datetime, date or time
Arguments:
mask
string
false
null
timezone
string
false
null
locale
string
false
null
timezone(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
toODBCDate(timezone=[string])
Creates a DateTime object with the format set to ODBC Implicit format
Arguments:
timezone
string
false
null
toODBCDateTime(timezone=[string])
Creates a DateTime object with the format set to ODBC Implicit format
Arguments:
timezone
string
false
null
toODBCTime(timezone=[string])
Creates a DateTime object with the format set to ODBC Implicit format
Arguments:
timezone
string
false
null
week(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
year(timezone=[string], locale=[string])
Provides the BIF and member functions for all time unit request with no arguments
Arguments:
timezone
string
false
null
locale
string
false
null
Examples
Last updated
Was this helpful?