Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Auto calculate Dates?


Former Community Member

I'm in the process of designing a new time sheet for our employees. We have a box where the two week period the sheet is for needs to be entered, along with rows for each day, showing the amount of hours worked. Is there a way for our user to input the day the time sheet starts on and it automatically fill out the ending date and fill in each individual box.

If I confused anyone, just let me know and I'll clarify to the best of my ability.

Thanks in advance,

2 Replies


Level 7
You have to use the Date/Time object and the "Date2Num()" and "Num2Date()" functions. The format of of the date string is very necessary and important because if you do not have it correct for the date string being passed to the 'Date2Num()" funciton you will not get a valid answer.

The "Date2Num()" funciton will convert a passed date into the number of days from the fixed Epoch Date of LiveCycle Designer, you can then add the number of days for the next date you want and use the "Num2Date()" funciton to convert the new number of days from the Epoch Date to a date string.


Level 1

Here is the code I use.

Use this code on the a text field.

Put the following code as Calculate in FormCalc(exclude the ------- divider):

----------beginning of the code-----------


(HasValue(xyz)) then

Num2Date( (Date2Num(xyz.formattedValue

, "MM/DD/YYYY") + ###), "MM/DD/YYYY")




--------ending of the code--------

=> Replace xyz with the field name, which your employee fills in

=> Replace ### with the number of days you want to add to