Date Formating in either Javascript or FormCalc Livecycle es4

I am very new to trying to fix code so any help would be greatly appreciated.
The application i am working with dictates the date but it is in the wrong format. I am Looking to make it show up as mm/dd/yyyy. it currently is showing as yyyy/mm/dd. the suggestion i was given is as follows

If you use Formcalc, it has functions (I believe Javascript does as well) that will convert the incoming date to a number from Jan 1 1900 and then you can switch that back to a date in the format that you want. I was trying it yesterday but hit some issues.

I’m thinking we need to substring off the date portion of the value (maybe up to the blank space) then use that with the date2Num function. Then take the result and use the num2Date function to convert it back to a date in the format we want. Then concatenate that date with the rest of the original field (the time details that we’d have to substring out and save as a variable) to put out on the form.

I am unsure how to make this happen.

this is the current scripting
formcalc
ImportRFQ.rfqDetail.LineItems.Row1.IssueDate::initialize - (FormCalc, client)
Javascript
ImportRFQ.rfqDetail.LineItems.Row1.IssueDate::initialize - (JavaScript, client)
Any help would be very much appreciate

Javascript just uses the toString method to format…

var d1 = new Date();
d1.toString('MM/dd/yyyy'); 

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.