cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Date Format Change

amit_saroha
New Contributor III

Hi There,

I have multiple mappers with multiple date columns in YYYY-MM-DD format, within each mapper which I have to convert into the Oracle database data format.

As of now, I am using expression distinctly on each and every column in mappers but this is time-consuming and error-prone. Could you suggest if there is a way to standardize date conversion process e.g. using any expression files?

1 REPLY 1

viktor_n
Contributor II

Hi @amit.saroha,

You can write your custom functions inside the expression file.
With this you will replace all those repeated expressions to reference to the of the expression file, and in feature if you choose to change the format of that dates, you would need only to update the expression file with the new date format.

Here is an example of how you can do that.
Expression File:

{
   formatDate: (date) => Date.parse(date).toLocaleDateTimeString({format: "YYYY-MM-DD"})
}

functions from expression file you can call them like this:

lib.ExpressionFileName.formatDate($date)

Regards,
Viktor