Cloud Software Group, Inc. EBX®
Documentation > Developer Guide > EBX® Script > API
Navigation mode Documentation > Developer Guide > EBX® Script > API

# Unit core.datetime

Script unit that provides datetime functions.

Methods
function addDays(value: datetime, days: decimal): datetime Adds days to a date and time.
function addHours(value: datetime, hours: decimal): datetime Adds hours to a date and time.
function addMinutes(value: datetime, minutes: decimal): datetime Adds minutes to a date and time.
function addMonths(value: datetime, months: decimal): datetime Adds months to a date and time.
function addSeconds(value: datetime, seconds: decimal): datetime Adds seconds to a date and time.
function addYears(value: datetime, years: decimal): datetime Adds years to a date and time.
function days(startValue: datetime, endValue: datetime): decimal Returns the number of days between two date and times.
function fromDate(value: date): datetime Converts a date to date and time with time set to 00:00:00.
function fromDateAndTime(dateValue: date, timeValue: time): datetime Creates a date and time given date and time values.
function months(startValue: date, endValue: date): decimal Returns the number of months between two date and times.
function now(): datetime Returns current date and time.
function of(year: decimal, month: decimal, day: decimal, hour: decimal, minute: decimal, second: decimal): datetime Creates a date and time given year, month, day, hours, minutes and seconds.
function seconds(startValue: datetime, endValue: datetime): decimal Returns the number of seconds between two date and times.
function years(startValue: date, endValue: date): decimal Returns the number of full years between two date and times.

## addDays

function addDays(value: datetime, days: decimal): datetime

Adds days to a date and time.

Parameters :

value: the input date and time

months: the number of days to be added. Must be an integer.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## addHours

function addHours(value: datetime, hours: decimal): datetime

Adds hours to a date and time.

Parameters :

value: the input date and time

hours: the number of hours to be added. Must be an integer.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## addMinutes

function addMinutes(value: datetime, minutes: decimal): datetime

Adds minutes to a date and time.

Parameters :

value: the input date and time

minutes: the number of minutes to be added. Must be an integer.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## addMonths

function addMonths(value: datetime, months: decimal): datetime

Adds months to a date and time.

Parameters :

value: the input date and time

months: the number of months to be added. Must be an integer.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## addSeconds

function addSeconds(value: datetime, seconds: decimal): datetime

Adds seconds to a date and time. Fractions of seconds are supported with millisecond precision.

Parameters :

value: the input date and time

seconds: the number of seconds to be added. Fractions are rounded to three decimal digits.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## addYears

function addYears(value: datetime, years: decimal): datetime

Adds years to a date and time.

Parameters :

value: the input date and time

months: the number of years to be added. Must be an integer.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## days

function days(startValue: datetime, endValue: datetime): decimal

Returns the number of days between two date and times. This function is equivalent to days(toDate(startValue), toDate(endValue)).

Parameters :

startValue: the input start date and time

endValue: the input end date and time

Return :

the number of days or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## fromDate

function fromDate(value: date): datetime

Converts a date to date and time with time set to 00:00:00.

Parameters :

value: the input date

Return :

the new date and time or null if parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## fromDateAndTime

function fromDateAndTime(dateValue: date, timeValue: time): datetime

Creates a date and time given date and time values.

Parameters :

dateValue: the input date

timeValue: the input time

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## months

function months(startValue: date, endValue: date): decimal

Returns the number of months between two date and times.

Parameters :

startValue: the input start date and time

endValue: the input end date and time

Return :

the number of months or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## now

function now(): datetime

Returns current date and time.

Return :

the current date and time.

Can be used in: Script tasks, Table triggers, Function fields without search optimization

## of

function of(year: decimal, month: decimal, day: decimal, hour: decimal, minute: decimal, second: decimal): datetime

Creates a date and time given year, month, day, hours, minutes and seconds. Fractions of seconds are supported with millisecond precision.

Parameters :

year: the input year

month: the input month

day: the input day

hour: the input hour

minute: the input minute

second: the input second. Fractions are rounded to three decimal digits.

Return :

the new date and time or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## seconds

function seconds(startValue: datetime, endValue: datetime): decimal

Returns the number of seconds between two date and times. Fractions of seconds are supported with millisecond precision.

Parameters :

startValue: the input start date and time inclusive

endValue: the input end date and time exclusive

Return :

the number of seconds or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

## years

function years(startValue: date, endValue: date): decimal

Returns the number of full years between two date and times.

Parameters :

startValue: the input start date and time

endValue: the input end date and time

Return :

the number of years or null if any parameter is null.

Can be used in: Script tasks, Table triggers, Function fields

Documentation > Developer Guide > EBX® Script > API