Skip to main content
Version: Python

datetime_col

The datetime_col method creates a column containing date-time values.

note

This method is commonly used with `new_table`` to create tables.

Syntax

datetime_col(columnName, values...)

Parameters

ParameterTypeDescription
columnNameString

The name of the new column.

valuesDateTime...

The column values.

Returns

A ColumnHolder.

Example

The following examples use `new_table`` to create a table with a single column of date-times named DateTimes.

from deephaven.time import to_datetime
from deephaven import new_table
from deephaven.column import datetime_col

firstTime = to_datetime("2021-07-04T08:00:00 NY")
secondTime = to_datetime("2021-09-06T12:30:00 NY")
thirdTime = to_datetime("2021-12-25T21:15:00 NY")

result = new_table([
datetime_col("DateTimes", [firstTime, secondTime, thirdTime])
])