0

I am currently working with Pentaho GeoKettle (or Spoon) and I am trying to import data into a database from a csv file. In the csv-file, there is a column which holds a timestamp in Epoch-format. But I have to import it to the database in the human timestamp(with timezone)-format: for example: 2017-06-01 13:10:12+00

How can this be achieved in geokettle?

user7335295
  • 401
  • 2
  • 7
  • 31

1 Answers1

1

A date is a date and the same whatever the format you want to use to make it human readable or computer writable. In kettle, a column has a value (which is a byte value), a type (which maybe a date) and a format(which may be 'yyyy-MM-dd hh:mm:ssZ', with Z for time zone).

So, if you read a timestamp as a integer in a coluimn named myDate, you need to convert it into a Date. And the easiest is to use a Modified Javascript value with a single line of code:

myDate = new Date(myDate)

and in the bottom table, put myDate as Fieldname with Type date and say Yes in the column Replace in fieldset.

Now that myDate has the right type, you set its format on the Meta-data tab of a Select value step. Select the format from the drop-down (and you can add a final Z for the final +0:00 if you want a Zulu time). You can also select the language and the time zone.

AlainD
  • 6,187
  • 3
  • 17
  • 31