Incrementing a date in openrefine

406 views Asked by At

I have a date in format of YYYY-MM-DDThh:mm:ss

Please provide a GREL expression that increments date to 1 month from the present date value for all cells in the column in openrefine. Thanks!

1

There are 1 answers

2
Owen Stephens On BEST ANSWER

First you need to make sure the data in the cells is of type 'date' - if the text in the cell is in green then the data is already 'date' type. Otherwise you will need to convert it using the GREL:

value.toDate()

Screenshot - before converting to date

dates in OpenRefine as String type

Screenshot - after converting to date

dates in OpenRefine as Date type

Once you have the data as Date type, then you can use the following GREL to increment by one month:

value.inc(1,'month')

For more on using dates in OpenRefine see https://github.com/OpenRefine/OpenRefine/wiki/GREL-Date-Functions