Skip to main content
Participating Frequently
August 14, 2017
Answered

Time sheet

  • August 14, 2017
  • 1 reply
  • 1119 views

Hello, greeting from Indonesia

Im new for javascript, im trying make timesheet for daily planner. The first day is monday. I want to make  pdf automatically fill the first date for next monday. example: now is monday 8/14/2017, the date fill with this date, but if i make timesheet tomorrow, (tuesday 8/15/2017) the first date will show next monday date (8/21/2017). Could you help me. Thank you and im sorry my english is terrible. Thanks

This topic has been closed for replies.
Correct answer try67

im sorrry, i make timesheet for pdf intearctive, thanks


OK. Let's say the field is called "Monday". Go to Tools - JavaScript - Document JavaScripts, create a new item (let's call it "scripts"), and then paste this code into it (delete any pre-existing code that is generated there):

var d = new Date();

while (d.getDay()!=1) d.setDate(d.getDate()+1);

this.getField("Monday").value = util.printd("mm/dd/yyyy", d);

1 reply

try67
Community Expert
Community Expert
August 14, 2017

Your English is not terrible at all... It's actually very good. No need to apologize.

So when do you want the dates to update? When you open a file? When you click on a button in the file?

Participating Frequently
August 14, 2017

try67

Thank you for replying so fast....

Actually i want the dates update when the file opened, so no need to fill the date manually, thank you so much

Participating Frequently
August 14, 2017

im sorrry, i make timesheet for pdf intearctive, thanks