Pentaho kettle value conversion

633 Views Asked by At

I wanted to convert microseconds to data:

60000000 -> 1997-2-12 (something like this).

This means the new field contains year-month-day-hour-minute-seconds-microseconds

Thx.

1

There are 1 best solutions below

0
On

microseconds (or any time span) can't be directly converted to a date, because you need a starting date and then add your timespan to that date, to end up with a calculated date. Quite often, timespans expressing dates are using the unix epoch start date of January 1st, 1970, 0:00 UTC as their base date.

To calculate your target date, you could use the Calculator step from Kettle. First reverse the sign of your microseconds timespan (multiply with -1), then use the calculation Date A - Date B (milliseconds) to calculate your new date.

Example

as your new field is a Date field, you can format the output to your own specification.