Extract dates/times from a string or Datetime column
Working with datetime values often involves extracting specific components, such as the time, to perform data analysis or gain insights. In Toric, extracting the time from a datetime string can be achieved efficiently using the RegEx Extract
node for columns with the Text
type or the Date Extract
node for columns with the Datetime
type.
In this article, we will walk you through the steps required to extract the time component from a datetime value, using a practical example and a helpful video demonstration. By the end, you will have a solid understanding of how to leverage Toric nodes to extract the desired time information from datetime strings.
Example 1: Using The Date Extract Node To Extract From Datetime
Let’s say that you have a string column with datetime values such as 2022-03-21T17:15:00Z
, or let’s say you have a datetime columns with datetime values such as 3/21/22
, and you want to extract the time 17:15:00
(which is in UTC) in your local time zone (such as PST).
You can use a combination of the following nodes to do so:
Edit Column
Date Extract
Split
Combine Columns
First, make sure your values are in Datetime format (such as 3/21/22
). If you have a string such as 2022-03-21T17:15:00Z
, use the Edit Column
node to change the column type to Date:


Next, use the Date Extract
node to extract the date or time values you want:

Note above that the extracted values are in my local time zone (PST), which is why the hour is 10 AM, and not 5 PM (UTC).
If you’ve extracted Hour 12
and want to isolate the AM
or PM
value, use the Split
node to accomplish this. You can ignore this if you are extracting Hour 24
.

Now if you’d like to combine the time values into one timestamp, separated by a “:”, you can use the Combine Columns
node:

And if you’d like to edit the names of the columns, you can use the Edit Column
node:

In summary, you can use the following nodes to extract and format your Datetime values however you’d like:
Edit Column
Date Extract
Split
Combine Columns
Example 2: Using Regex To Extract Dates From Strings
Let’s say that you have a string column with datetime values such as 2022-03-21T17:15:00Z
, and you want to extract the time 17:15:00
, you can use the RegEx Extract
node to do so.
In this case, your RegEx Expression
would be: T(\d+:\d+:\d+)

Please reach out if you have any questions!