DateTime functions are used for parsing and manipulating the platform's date/time timestamps. Due to various technical reasons the platform represents timestamps using the long data type instead of the native .NET DateTime and Python DateTime structure (see the DateTimeConvert function).


Sections


Functions

Function Details


Functions


Name

Description

long DateTimeAddDays(long, int)

Adds/subtract a specified number of days to a specified date/time.

long DateTimeAddHours(long, int)

Adds/subtract a specified number of hours to a specified date/time.

long DateTimeAddMinutes(long, int)

Adds/subtract a specified number of minutes to a specified date/time.

long DateTimeAddMonths(long, int)

Adds/subtract a specified number of months to a specified date/time.

long DateTimeAddSeconds(long, int)

Adds/subtract a specified number of seconds to a specified date/time.

long DateTimeAddYears(long, int)

Adds/subtract a specified number of years to a specified date/time.

DateTime DateTimeConvert(long)

Converts a specified date/time to a native .NET date/time structure.

long DateTimeCreate(int, int, int, int, int, int)

Creates a new date/time from specified date/time fragments. The new date/time will be specified in the selected time zone, which is UTC by default. (See DateTimeSetUTCZone and DateTimeSetLocalZone)

long DateTimeCurrent()

Gets the Desktop's current date/time.

int DateTimeDay(long)

Gets the day of month at a specified date/time (1 to 31)

double DateTimeDayDistance(long, long)

Gets the distance in days between two specified date/times.

C_Weekday DateTimeDayOfWeek(long)

Gets the day of week at a specified date/time.

int DateTimeDayOfYear(long)

Gets the day of year at a specified date/time. (0 to 364)

long DateTimeEnd()

Gets the Desktop's end date/time.

int DateTimeHour(long)

Gets the hour at a specified date/time. (0 to 23)

double DateTimeHourDistance(long, long)

Gets the distance in hours between two specified date/times.

bool DateTimeIsLeapYear(long)

Checks whether a specified date/time is a leap year.

long DateTimeMax()

Gets the maximum possible date/time.

int DateTimeMicrosecond(long)

Gets the microseconds at a specified date/time.

int DateTimeMillisecond(long)

Gets the milliseconds at a specified date/time.

long DateTimeMin()

Gets the minimum possible date/time.

int DateTimeMinute(long)

Gets the minutes at a specified date/time. (0 to 59)

double DateTimeMinuteDistance(long, long)

Gets the distance in minutes between two specified date/times.

int DateTimeMonth(long)

Gets the month at a specified date/time. (1 to 12)

int DateTimeSecond(long)

Gets the seconds at a specified date/time. (0 to 59)

double DateTimeSecondDistance(long, long)

Gets the distance in seconds between two specified date/times.

DateTimeSetLocalZone()

Sets the time zone of all the date/time functions to the system's local zone. Call this function once prior to calling other DateTime functions in order for them to be in the local zone.

DateTimeSetTimeZone(C_TimeZone)

Sets the time zone of all the date/time functions to a specified time zone. Call this function once prior to calling other DateTime functions in order for them to be in the specified time zone.

DateTimeSetUTCZone()

Resets the time zone of all the date/time functions to UTC. Call this function once prior to calling other DateTime functions in order for them to be in UTC. Note that UTC is the default time zone.

long DateTimeStart()

Gets the Desktop's first start date/time since the last reset.

string DateTimeString(long, bool)

Gets the string representation of a date/time. (yyyy-MM-dd HH:mm:ss)

int DateTimeYear(long)

Gets the year at a specified date/time.


Function Details


long DateTimeAddDays(long dateTime, int days)

Adds/subtract a specified number of days to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified days.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

days

The number of days to add (negative to subtract)


Scripts


All


long DateTimeAddHours(long dateTime, int hours)

Adds/subtract a specified number of hours to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified hours.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

hours

The number of hours to add (negative to subtract)


Scripts


All


long DateTimeAddMinutes(long dateTime, int minutes)

Adds/subtract a specified number of minutes to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified minutes.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

minutes

The number of minutes to add (negative to subtract)


Scripts


All


long DateTimeAddMonths(long dateTime, int months)

Adds/subtract a specified number of months to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified months.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

months

The number of months to add (negative to subtract)


Scripts


All


long DateTimeAddSeconds(long dateTime, int seconds)

Adds/subtract a specified number of seconds to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified seconds.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

seconds

The number of seconds to add (negative to subtract)


Scripts


All


long DateTimeAddYears(long dateTime, int years)

Adds/subtract a specified number of years to a specified date/time.


Returns


The specified date/time after adding/subtracting the specified years.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to modify

int

years

The number of years to add (negative to subtract)


Scripts


All


DateTime DateTimeConvert(long dateTime)

Converts a specified date/time to a native .NET date/time structure.


Returns


The specified date/time in the native .NET date/time structure.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to convert


Scripts


All


long DateTimeCreate(int year, int month, int day, int hour, int minute, int second)

Creates a new date/time from specified date/time fragments. The new date/time will be specified in the selected time zone, which is UTC by default. (See DateTimeSetUTCZone and DateTimeSetLocalZone)


Returns


The date/time created in the set time zone from the specified date/time fragments.


Parameters


Type

Identifier

Description

int

year

The date/time year

int

month

The date/time month (1 to 12)

int

day

The date/time day (1 to 31)

int

hour

The date/time hour (0 to 23)

int

minute

The date/time minute (0 to 59)

int

second

The date/time second (0 to 59)


Scripts


All


long DateTimeCurrent()

Gets the Desktop's current date/time.


Returns


The Desktop's current date/time.


Scripts


All


int DateTimeDay(long dateTime)

Gets the day of month at a specified date/time (1 to 31)


Returns


The day of month at the specified date/time. (1 to 31)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the day of month from


Scripts


All


double DateTimeDayDistance(long earlyDateTime, long lateDateTime)

Gets the distance in days between two specified date/times.


Returns


The distance in days between the two specified date/times.


Parameters


Type

Identifier

Description

long

earlyDateTime

The early date/time

long

lateDateTime

The late date/time


Scripts


All


C_Weekday DateTimeDayOfWeek(long dateTime)

Gets the day of week at a specified date/time.


Returns


The day of week at the specified date/time. (View Options)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the day of week from


Scripts


All


int DateTimeDayOfYear(long dateTime)

Gets the day of year at a specified date/time. (0 to 364)


Returns


The day of year at the specified date/time. (0 to 364)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the day of year from


Scripts


All


long DateTimeEnd()

Gets the Desktop's end date/time.


Returns


The Desktop's end date/time.


Scripts


All


int DateTimeHour(long dateTime)

Gets the hour at a specified date/time. (0 to 23)


Returns


The hour at the specified date/time. (0 to 23)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the hour from


Scripts


All


double DateTimeHourDistance(long earlyDateTime, long lateDateTime)

Gets the distance in hours between two specified date/times.


Returns


The distance in hours between the two specified date/times.


Parameters


Type

Identifier

Description

long

earlyDateTime

The early date/time

long

lateDateTime

The late date/time


Scripts


All


bool DateTimeIsLeapYear(long dateTime)

Checks whether a specified date/time is a leap year.


Returns


True if the date/time is a leap year, false otherwise.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to check


Scripts


All


long DateTimeMax()

Gets the maximum possible date/time.


Returns


The maximum possible date/time, i.e. the last second of the year 9999.


Scripts


All


int DateTimeMicrosecond(long dateTime)

Gets the microseconds at a specified date/time.


Returns


The microseconds at the specified date/time.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the microseconds from


Scripts


All


int DateTimeMillisecond(long dateTime)

Gets the milliseconds at a specified date/time.


Returns


The milliseconds at the specified date/time.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the millisecond from


Scripts


All


long DateTimeMin()

Gets the minimum possible date/time.


Returns


The minimum possible date/time, i.e. the first second of the year 0001.


Scripts


All


int DateTimeMinute(long dateTime)

Gets the minutes at a specified date/time. (0 to 59)


Returns


The minutes at the specified date/time. (0 to 59)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the minute from


Scripts


All


double DateTimeMinuteDistance(long earlyDateTime, long lateDateTime)

Gets the distance in minutes between two specified date/times.


Returns


The distance in minutes between the two specified date/times.


Parameters


Type

Identifier

Description

long

earlyDateTime

The early date/time

long

lateDateTime

The late date/time


Scripts


All


int DateTimeMonth(long dateTime)

Gets the month at a specified date/time. (1 to 12)


Returns


The month at the specified date/time. (1 to 12)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the month from


Scripts


All


double DateTimeSecondDistance(long earlyDateTime, long lateDateTime)

Gets the distance in seconds between two specified date/times.


Returns


The distance in seconds between the two specified date/times.


Parameters


Type

Identifier

Description

long

earlyDateTime

The early date/time

long

lateDateTime

The late date/time


Scripts


All


int DateTimeSecond(long dateTime)

Gets the seconds at a specified date/time. (0 to 59)


Returns


The seconds at the specified date/time. (0 to 59)


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the seconds from


Scripts


All


DateTimeSetLocalZone()

Sets the time zone of all the date/time functions to the system's local zone. Call this function once prior to calling other DateTime functions in order for them to be in the local zone.


Scripts


All


DateTimeSetTimeZone(C_TimeZone timeZone)

Sets the time zone of all the date/time functions to a specified time zone. Call this function once prior to calling other DateTime functions in order for them to be in the specified time zone.


Parameters


Type

Identifier

Description

C_TimeZone

timeZone

The time zone to switch to


Scripts


All


DateTimeSetUTCZone()

Resets the time zone of all the date/time functions to UTC. Call this function once prior to calling other DateTime functions in order for them to be in UTC. Note that UTC is the default time zone.


Scripts


All


long DateTimeStart()

Gets the Desktop's first start date/time since the last reset.


Returns


The Desktop's start date/time.


Scripts


All


string DateTimeString(long dateTime, bool onlyDate)

Gets the string representation of a date/time. (yyyy-MM-dd HH:mm:ss)


Returns


The string representation of the date/time. (yyyy-MM-dd HH:mm:ss)


Parameters


Type

Identifier

Description

long

dateTime

The date/time

bool

onlyDate

Use for indicating whether to print only the date


Scripts


All


int DateTimeYear(long dateTime)

Gets the year at a specified date/time.


Returns


The year at the specified date/time.


Parameters


Type

Identifier

Description

long

dateTime

The date/time to get the year from


Scripts


All