Skip to main content



ToDateTime Function

The ToDateTime function converts an expression to a DateTime value.

Syntax 1

ToDateTime(year)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

Syntax 2

ToDateTime(expression)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

Syntax 3

ToDateTime(year, month)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

Syntax 4

ToDateTime(expression, month)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

Syntax 5

ToDateTime(year, month, day)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

Syntax 6

ToDateTime(expression, month, day)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

Syntax 7

ToDateTime(year, month, day, hour)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

Syntax 8

ToDateTime(expression, month, day, hour)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

Syntax 9

ToDateTime(year, month, day, hour, minute)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

Syntax 10

ToDateTime(expression, month, day, hour, minute)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

Syntax 11

ToDateTime(year, month, day, hour, minute, second)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

second Integer - An integer or integer expressin representing the second, in the range 0-59.

Syntax 12

ToDateTime(expression, month, day, hour, minute, second)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

second Integer - An integer or integer expressin representing the second, in the range 0-59.

Syntax 13

ToDateTime(year, month, day, hour, minute, second, millisecond)

The ToDateTime function converts an expression to a DateTime value.

Arguments

year Integer - An integer or integer expression representing the year.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

second Integer - An integer or integer expressin representing the second, in the range 0-59.

millisecond Integer - An integer or integer expressin representing the millisecond, in the range 0-999.

Syntax 14

ToDateTime(expression, month, day, hour, minute, second, millisecond)

The ToDateTime function converts an expression to a DateTime value.

Arguments

expression Expression - The expression to convert, either by evaluating to a number or a date and time in string format.

month Integer - An integer or integer expression representing the month, in the range 1-12.

day Integer - An integer or integer expression representing the day, in the range 1-31.

hour Integer - An integer or integer expression representing the hour, in the range 0-23.

minute Integer - An integer or integer expressin representing the minute, in the range 0-59.

second Integer - An integer or integer expressin representing the second, in the range 0-59.

millisecond Integer - An integer or integer expressin representing the millisecond, in the range 0-999.

Remarks

Example:

ToDateTime("2005/1/1"); // returns "2005-1-1T0:00:00"

Example:

ToDateTime(2005, 10, 14, 23, 59, 59, 476)  // returns "2005-10-14T23:59:59:476"