2

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!

danimal
  • 23
  • 3

1 Answers1

0

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

Owen Stephens
  • 1,550
  • 1
  • 8
  • 10
  • If it's green, it could also be a numeric value and not just a date. – Jerry Dec 19 '18 at 17:54
  • That’s true in a general sense (and boolean values also render in green text), but in the context of the question which states “I have a date in the format YYYY-MM-DDThh:mm:ss” the text being in green can only indicate a date – Owen Stephens Dec 24 '18 at 17:29