Highlighted

Change one date format to another.

New Here ,
Apr 23, 2019

Copy link to clipboard

Copied

In the date1 field, I have a date in ddmmyyyy format. In the date2 field, I want to display a date from the date1 field in the d. m. yyyy format. How to do it?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can use this code as the custom calculation script of "date2":

var s1 = this.getField("date1").valueAsString;

if (s1=="") event.value = "";

else {

    var d1 = util.scand("ddmmyyyy", s1);

    event.value = util.printd("d.m.yyyy", d1);

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

290

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Change one date format to another.

New Here ,
Apr 23, 2019

Copy link to clipboard

Copied

In the date1 field, I have a date in ddmmyyyy format. In the date2 field, I want to display a date from the date1 field in the d. m. yyyy format. How to do it?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can use this code as the custom calculation script of "date2":

var s1 = this.getField("date1").valueAsString;

if (s1=="") event.value = "";

else {

    var d1 = util.scand("ddmmyyyy", s1);

    event.value = util.printd("d.m.yyyy", d1);

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

291

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 23, 2019 0
Most Valuable Participant ,
Apr 23, 2019

Copy link to clipboard

Copied

You can use this code as the custom calculation script of "date2":

var s1 = this.getField("date1").valueAsString;

if (s1=="") event.value = "";

else {

    var d1 = util.scand("ddmmyyyy", s1);

    event.value = util.printd("d.m.yyyy", d1);

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 23, 2019 1
New Here ,
Oct 31, 2020

Copy link to clipboard

Copied

Oh my goodness, brilliant. Thanks so much.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 31, 2020 0
New Here ,
Apr 23, 2019

Copy link to clipboard

Copied

Super! It works perfectly!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 23, 2019 0