ToDateTime Function

  • Updated

The ToDateTime function converts an expression to a DateTime value.

Syntax 1

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(year)

 

 

Arguments:

 

 

 

year

Integer - An integer or integer expression representing the year.

Syntax 2

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(expression)

 

 

Arguments:

 

 

 

expression

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

Syntax 3

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(year, month)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(expression, month)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(year, month, day)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(expression, month, day)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(year, month, day, hour)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

ToDateTime(expression, month, day, hour)

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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

 

The ToDateTime function converts an expression to a DateTime value.

 

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

 

 

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".

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.