• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Change one date format to another.

New Here ,
Apr 23, 2019 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?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

448

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
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 23, 2019 Apr 23, 2019

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
Community Expert ,
Apr 23, 2019 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
community guidelines
New Here ,
Oct 31, 2020 Oct 31, 2020

Copy link to clipboard

Copied

LATEST

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
community guidelines
New Here ,
Apr 23, 2019 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
community guidelines