Skip to main content
Participant
July 27, 2020
Question

building a timesheet.

  • July 27, 2020
  • 1 reply
  • 380 views

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

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 27, 2020

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...