Question

I have a table that contains a column named time_created representing a date: 2014-02-19 23:49:59.998557. Now I need to generate a new table that consists of year, month, day and quarter columns.(For analysis purpose).

For example, 2014-02-19 23:49:59.998557 should be converted to:

year| month | day | quarter

2014 | 2 | 19 | Q1

How can I do that using Kettle? Thanks!

Was it helpful?

Solution 2

Use a calculator step to generate the four fields you need (year, month,..). For each field use your timestamp as Field A and choose the appropriate calculation (e.g. Year of date A). You will need to work around the quarter field to prepend a Q (calculation = set field to constant value A ). You can do this in the same calculator step, using the remove feature to get rid of your Q field.

OTHER TIPS

Or use the select values step.. this can make copies of fields then you simply specify the format mask for the date to string conversion in the meta tab. Potentially more flexible too..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top