Performing date transformations in Soma
The Algoreus allows you to interactively and visually specify transformations on a sample of data. It provides a list of built-in directives that you can use to transform your data. Additionally, it also provides a set of directives such as set-column, where you can invoke JEXL expressions. One of the most common and powerful use cases of this is to perform date manipulation. This topic describes some of the available transformations.
Uploading a sample
Click Add Connection and create a File connection.
Locate the file and double-click it.
Set Enable Quoted Values to True.
Set Use First Row as Header to True.
Click Confirm.
The file appears in your Algoreus workspace
Transforming dates
Let’s parse the date column as a date.
Click the directive dropdown in that column, and then choose Parse > Simple Date.
Specify a Custom format such as MM/dd/yy HH:mm. The date format must match the dates in the column. If you select a date format that doesn’t match the dates in the column, you will get incorrect results.
Click Apply.
In the Transformation steps column, you should see the transformation registered as parse-as-simple-date
Also observe that the data type of the column has now changed from String to Timestamp_micros, which exposes a lot of utility functions on dates that we will use in the next section.
Getting components
You can get various components of the date such as Month, Day, Year, Minute, Second, and Hour by applying functions such as:
Adding time
You can add various units of time to the date by using the directives such as:
Subtracting time
You can subtract various units of time from the date by using the directives such as:
Last updated