How do I display timestamp values in my table with or without the date?
Note
The document's screenshot and code examples use db.t
, DBDateTime
date times, and getMeta
, but the concepts also apply to Core+ and db.historicalTable
, Instant
date times, and meta
.
The DBDateTime
variable common in the timestamp column includes both the date and time (e.g., "2020-06-08T12:00 NY"
). However, the UI may be set up to display only time. For example, the StockQuotes
table in the LearnDeephaven
namespace opens as shown below:
quotes = db.t("LearnDeephaven", "StockQuotes").where("Date=`2017-08-25`")
The Timestamp column displays only the time. However, this is actually a DBDateTime
. You can determine this in one of two ways:
- Hover over an individual column header:
- Use the
getMeta
method to see information about all the columns:
t = db.t("LearnDeephaven", "StockQuotes").getMeta()
Or, since in our example case the quotes
table is already open:
Meta = quotes.getMeta()
Determining the correct data type is important because, for instance to filter the timestamp column, your query must include the full format (e.g., "Timestamp='2020-06-08T12:00 NY'"
).
You can display the full value by adjusting the UI settings: