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

calculating age in weeks and days

Community Beginner ,
Nov 26, 2019 Nov 26, 2019

Copy link to clipboard

Copied

Help please 

if I need to calculate the gestational age in a certain date (any date)

how do I do please ?

  

I have 2 feilds 

the first "DG" date of conception

the second "age" the date at which i want to calcule the gestational age in weeks and days 

this my script (try67 helped me in this script) but this script is for the today date :

var dateFormat = "dd/mm/yyyy"; var startDateString = this.getField("DG").valueAsString; event.value = ""; if (startDateString!="") { var startDate = util.scand(dateFormat, startDateString); if (startDate!=null) { var now = new Date(); var dayInMs = 86400000; var diff = Math.round((now.getTime()-startDate.getTime())/dayInMs); var diffInWeeks = Math.floor(diff/7); var diffInDays = diff-(diffInWeeks*7); event.value = diffInWeeks + " SA " + diffInDays + " jours"; } }

please help me

TOPICS
Acrobat SDK and JavaScript

Views

151

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
Community Expert ,
Nov 26, 2019 Nov 26, 2019

Copy link to clipboard

Copied

LATEST

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