1

I read data from a csv file,and I get a string like "2010-7-3", I can't transform this data into timestamp,because it not like "2010-07-03"

What should I do?Is there a stage could handle this?

Erik A
  • 31,639
  • 12
  • 42
  • 67
wtm
  • 1,389
  • 4
  • 13
  • 18

1 Answers1

2

In the transformer, set up three stage variables - year, month and day. Their respective values should be as follows

Field(InputLink.string_date, "-", 1)
Right("0" : Field(InputLink.string_date, "-", 2), 2)
Right("0" : Field(InputLink.string_date, "-", 3), 2)

Then use this in the output column:

StringToTimestamp(year : month : day : "000000", "%yyyy%mm%dd%hh%nn%ss")
lins314159
  • 2,510
  • 1
  • 16
  • 19
  • I use the java stage and handle that problem by java code,I haven't try your solution,but thank you all the same. – wtm Jul 20 '12 at 03:03