faisal
faisal

Reputation: 21

convert string value in ate format in java script

i have a problem in converting a string date value into valid date format in pentaho-data-itegration .could someone help me to convert string date'08-Mar-2017' into date format (2017-03-08 00:00:00) in pentaho.

Upvotes: 0

Views: 1008

Answers (1)

AlainD
AlainD

Reputation: 6356

Date do not have a format in PDI.

To convert the '08-Mar-2017' string to a date, use the Select value step, Meta-data tab, and tell your field should be of type Date, and the conversion format is dd-MMM-yyyy (type it, as it not on the drop down list).

To convert the date to the '2017-03-08 00:00:00' string, use the Select value step, Meta-data tab, and tell your field should be of type String, and the conversion format is yyyy-MM-dd hh:mm:ss.

However, you most probably do not need to do it.

The only time a date format is used is for data input and output. Plus it is transparent, most of the time.

If your data comes from a file or data grid or a computation or many other steps, you can specify its format. If is comes from a Input table, think about converting with the sql build-in function : to-date, convert, cast, date depending on your database system.

If your output is a file or an Excel or a script, you can specify its format (which by default is yyyy-MM-dd hh:mm:ss). If it's a sql insert or update, don't do anything and let the databases do the conversion.

Upvotes: 1

Related Questions