Highlighted

building a timesheet.

New Here ,
Jul 26, 2020

Copy link to clipboard

Copied

I have built a timesheet for my employees but unfortunately it confuses some. I need it so you insert the date for the last day of the week and then it automatically fills in the dates next to the corresponding day. For example. 

11/02/2020 Wednesday. 

Please help

TOPICS
Acrobat SDK and JavaScript

Views

65

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

building a timesheet.

New Here ,
Jul 26, 2020

Copy link to clipboard

Copied

I have built a timesheet for my employees but unfortunately it confuses some. I need it so you insert the date for the last day of the week and then it automatically fills in the dates next to the corresponding day. For example. 

11/02/2020 Wednesday. 

Please help

TOPICS
Acrobat SDK and JavaScript

Views

66

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
Jul 26, 2020 0
try67 LATEST
Most Valuable Participant ,
Jul 27, 2020

Copy link to clipboard

Copied

Is that mm/dd/yyyy or dd/mm/yyyy? Either way, it's not a Wednesday...

Anyway, you can do it by creating two fields. Let's say the are called Date1 and Day1. As the custom calculation script of the latter enter the following code:

var s1 = this.getField("Date1").valueAsString;
if (s1=="") event.value = "";
else {
	var d1 = util.scand("dd/mm/yyyy", s1);
	event.value = util.printd("dddd", d1);
}

 

Make sure to adjust the first date format string to match the one you're using in Date1, of course...

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...
Jul 27, 2020 0