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(name: str, data: Sequence[Any]) -> InputColumn

Parameters

ParameterTypeDescription
namestr

The name of the new column.

dataSequence[Any]

A sequence of date-time values. This can be a list, tuple, or other sequence type.

Returns

An InputColumn.

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_j_instant
from deephaven import new_table
from deephaven.column import datetime_col

first_time = to_j_instant("2021-07-04T08:00:00 ET")
second_time = to_j_instant("2021-09-06T12:30:00 ET")
third_time = to_j_instant("2021-12-25T21:15:00 ET")

result = new_table([
datetime_col("DateTimes", [first_time, second_time, third_time])
])