Date Format Change to "dd-mm-yyyy" for catalog item variable

Rajarshi1
Tera Expert

Hi,

I have a requirement to populate the value of one catalog variable in "DD-MM-YYYY" format. This will happen based on a change in another catalog variable which is in "YYYY-MM-DD" format. I have written a catalog client script and a script include but the date format is not changing. It will be of great help if you suggest something on this. Am I missing something?

Client Script

find_real_file.png

Script Include

find_real_file.png

 

Output

find_real_file.png

Thanks,

Rajarshi

1 ACCEPTED SOLUTION

Try this-

After line 9

var formatdate= day.getByFormat("dd-MM-yyyy");

return formatdate;

 

View solution in original post

14 REPLIES 14

Ruhi Jibhyenka1
Mega Guru

Hi Rajashri,

Try below changes-

In your script include,

Use- return day.getDisplayValue(); instead of return day. 

Comment the line- day.getByFormat('dd-mm-yyyy');

 

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy.

Thanks,

Ruhi.

Hi Ruhi,

It didn't work. I made the changes as mentioned by you

find_real_file.png

Please let me know if I am missing something.

 

Thanks,

Rajarshi

Try this-

 return{

 

  s.setStringParameter('fieldname', day.getByFormat("dd/MM/yyyy")); 

 

  }

 

No Luck Ruhi!!