In the project setup steps recommended in this guide for the sample dataset, it was recommended to direct OpenRefine not to automatically parse out dates and numbers. Therefore any columns that appear to contain dates or numbers will consider them as text. For the Treatment_Date field, we can do a simple transformation to change it from text format to date.
Common Transform: To Date
- From the drop down arrow from the Treatment Date column, choose Edit cells, Common Transforms, then To date
- When this transformation is applied, the date formatted as text changes to an ISO-formatted datestamp, complete with timestamp:
Several different GREL formulas for additional transformations that can be done starting with data in the date format can be found here. In the example below we will transform this date back to a text format in a different style, while still maintaining the original date column.
Transform Date to Text in New Style
- From the Date column drop down arrow, select Edit column, then Add column based on this column
- Give the new column the name Formatted_Date
- In the Expression box type: value.toString("dd MMMM yyyy") Make sure the quotation marks are straight up-and-down, not curled.
- Click OK. This will change the date back to text format, in a different style.