how do I convert date yyyy-mm-dd to mm-dd-yyyy in script?

tried:

add(record.tables[“progressbilling”][index].fields[“Pb_Schedule_Dates”], function (value) { result += format.dateShort(value) ; });

but it doesn’t appear to work. What is the correct way to convert dates to the correct format?

Hello Ginger,

Are you not getting a short date as mm-dd-yy? Or are you having some error mensage?

To get a short date as mm-dd-yy, you must be sure that you selected the correct locale as “en-US”. Go to Edit/Locale and select Use: “Explicit locale” and Locale: “en-US”. it will work after you do that.

The easiest way to convert dates is using the wizard of the script: Double click on the date’s script and select “Short Date” on the Format Column

Luciano

Hi Luciano,

I am getting the short date for my placeholders that are text scripts. But for the scripts that are html selectors - it isn’t converting the date element. See sample of my script:

add(“<tr><td></td><td>” +record.tables[“progressbilling”][index].fields[“Pb_Schedule_Dates”], function (value) { result += value ; });

I tried formatting the value with something like format.dateShort(value); but it didn’t like that

Hi Ginger

I can see that you are missing a closing tag on your <td> and your <tr>.

To better understand what is not working with your script, we will need more details about the context of your script and selector.

I suggest you open an support call with us to better assist you. You can either go to http://planetpress.objectiflune.com/en/resources/support and click on ‘‘report an issue’’ or you can call at 1-866-348-5863.

Best regards

Luciano