DateTime
- Last Updated: October 26, 2026
- 5 minute read
- Corticon.js
- Version 2.4
- Documentation
Note: A DateTime data type must contain both date information and time information. Applying a DateTime operator to a DateTime attribute should always produce a result. Be sure to use the data type that suits your needs.
Corticon.js's DateTime attribute operators that enable date-only or time-only comparison are as follows:
| Name and Syntax | Returns | Description | |
|---|---|---|---|
| Is same date | |||
<DateTime1>.isSameDate (<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is the same as DateTime2, ignoring the time part. | |
| After date | |||
<DateTime1>.afterDate (<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is after DateTime2, ignoring the time part. | |
| Before date | |||
<DateTime1>.beforeDate (<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is before DateTime2, ignoring the time part. | |
| Is same time | |||
<DateTime1>.isSameTime (<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is the same as DateTime2, ignoring the date part. | |
| After time | |||
<DateTime1>.afterTime (<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is after DateTime2, ignoring the date part. | |
| Before time | |||
<DateTime1>.beforeTime(<DateTime2>) |
Boolean | Returns a value of true if DateTime1 is before DateTime2, ignoring the date part. | |
Corticon.js's DateTime attribute operators are as follows:
| Name and Syntax | Returns | Description | |
|---|---|---|---|
| Equals (used as a comparison) |
|||
| < |
Boolean | Returns a value of true if < |
|
| Equals(used as an assignment) |
|||
| < |
DateTime | Assigns the value of <DateTime2> to <DateTime1> |
|
| < |
Boolean | Returns a value of true if <DateTime1> does not equal <DateTime2> |
|
| Less than | |||
| < |
Boolean | Returns a value of true if <DateTime1> is less than <DateTime2> |
|
| Greater than | |||
| < |
Boolean | Returns a value of true if <DateTime1> is greater than or equal to <DateTime2> |
|
| < |
Boolean | Returns a value of true if <DateTime1> is less than or equal to <DateTime2> |
|
| < |
Boolean | Returns a value of true if <DateTime1> is greater than or equal to <DateTime2> |
|
| In (Range) | |||
|
|
Boolean | Returns a value of true if |
|
| In (List) | |||
|
|
Boolean | Returns a value of true if |
|
| Year | |||
<DateTime>.year |
Integer | Returns the century/year portion of <DateTime> as a four digit Integer |
|
| Month | |||
<DateTime>.month |
Integer | Returns the month in <DateTime> as an Integer between 1 and 12 |
|
| Day | |||
<DateTime>.day |
Integer | Returns the day portion of <DateTime> as an Integer between 1 and 31 |
|
| Hour | |||
<DateTime>.hour |
Integer | Returns the hour portion of <DateTime>. The returned value is based on a 24-hour clock. |
|
| Minute | |||
<DateTime>.min |
Integer | Returns the minute portion of <DateTime> as an Integer between 0 and 59 |
|
| Second | |||
<DateTime |
Integer | Returns the seconds portion of <>.sec DateTime> as an Integer between 0 and 59 |
|
| Add years | |||
<DateTime>.addYears (<Integer>) |
DateTime | Adds the number of years in <Integer> to the number of years in <DateTime> |
|
| Add months | |||
<DateTime>>.addMonths (<Integer>) |
DateTime | Adds the number of months in <Integer> to the number of months in <DateTime> |
|
| Add days | |||
| < |
DateTime | Adds the number of days in <Integer> to the number of days in <DateTime> |
|
| Add hours | |||
<DateTime>.addHours (<Integer>) |
DateTime | Adds the number of hours in < |
|
| Add minutes | |||
<DateTime>.addMinutes (<Integer>) |
DateTime | Adds the number of minutes in < |
|
| Add seconds | |||
<DateTime>.addSeconds (<Integer>) |
DateTime | Adds the number of seconds in < |
|
| Years between | |||
<DateTime1>.yearsBetween (<DateTime2>) |
Integer | Returns the Integer number of years between <DateTime1> and <Date2>. This function returns a positive number if <DateTime2> is later than <DateTime1>. |
|
| Months between | |||
<DateTime1>.monthsBetween (<DateTime2>) |
Integer | Returns the Integer number of months between < |
|
| Days between | |||
<DateTime1>.daysBetween (<DateTime2>) |
Integer | Returns the Integer number of days between < |
|
| Hours between | |||
<DateTime1>.hoursBetween (<DateTime2>) |
Integer | Returns the Integer number of hours between < |
|
| Minutes between | |||
<DateTime1>.minsBetween (<DateTime2>) |
Integer | Returns the Integer number of minutes between <DateTime1> and < |
|
| Weeks between | |||
<DateTime1>.weeksBetween (<DateTime2>) |
Integer | Returns the Integer number of weeks between <startDate> and <endDate>. |
|
| Seconds between | |||
<DateTime1>.secsBetween (<DateTime2>) |
Integer | Returns the Integer number of seconds between < |
|
| Day of Week | |||
<DateTime>.dayOfWeek |
Integer | Returns an Integer corresponding to day of the week, with Sunday equal to 1, in < |
|
| Week of Year | |||
<DateTime>.weekOfYear |
Integer | Returns an Integer from 1 to 52, equal to the week number within the year in < |
|
| Day of Year | |||
<DateTime>.dayOfYear |
Integer | Returns an Integer from 1 to 366, equal to the day number within the year in < |
|
| Week of Month | |||
<DateTime>.weekOfMonth |
Integer | Returns an Integer from 1 to 6, equal to the week number within the month in < |
|
<DateTime>.toDate |
Date | Returns the date portion only of DateTime | |
| getMilliseconds | |||
<DateTime>.getMilliseconds |
Integer | Returns the internal date/time, namely the number of milliseconds that have transpired since the epoch, 1/1/1970 00:00:00 GMT. |
|