calculating age in weeks and days

New Here ,
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, Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

117

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

calculating age in weeks and days

New Here ,
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, Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

118

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
Nov 26, 2019 0
ls_rbls LATEST
Adobe Community Professional ,
Nov 26, 2019

Copy link to clipboard

Copied

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...
Nov 26, 2019 0