cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Incorrect date format

amit_saroha
New Contributor III

Hi,

My requirement is to pass the date as a string โ€œYYYY/MM/DD HH:MI:SSโ€ as a parameter to Oracle procedure snap. I amssusing the expression - Date.now().toLocaleDateString({โ€œformatโ€:โ€œyyyy/MM/dd HH:mm:ssโ€}).toString()

I can see the correct format in the value but while it is passed as a parameter it always has additional characters as below -

image

image

Could you please suggest how I can correct this expression?

11 REPLIES 11

SpiroTaleski
Valued Contributor

@amit.saroha

What are the additional characters that you are getting?

The first screen date 2022/06/13 11:57:32 looks fine.

The second one 2022-06-13T12:03:38.000Z has completely different format.

BR,
Spiro Taleski

Yes, when itโ€™s passed as a parameter to Oracle Procedure Snap it changed to 2022/06/13 11:57:32 > 2022-06-13T12:03:38.000Z.

Any way to keep it as 2022/06/13 11:57:32?

image

SpiroTaleski
Valued Contributor

โ€œYes, when itโ€™s passed as a parameter to Oracle Procedure Snap it changed to 2022/06/13 11:57:32 > 2022-06-13T12:03:38.000Z.โ€ - this shouldnโ€™t happen.

From the screen I can see that the date is mapped from input(โ€œ$p_processing_dateโ€). It is not taken from parameter.

If you try to parse the value from parameter as date back, then you will get the โ€œ2022-06-13T12:03:38.000Zโ€.

So, if you procedure expect the field as date, probably you will need to handle the date conversion and format on procedure level. Otherwise, you can pass the field as string(without parsing back as date), directly from parameter: _p_processing_date

BR,
Spiro Taleski

Actually, itโ€™s passed from parameter only, please see below and I couldnโ€™t understand what do you mean by _p_processing_date and where I have to pass it?

image

image