Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Auto calculate Dates?

Avatar

15-08-2008

Hello,

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,

Justin

Replies

Avatar

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
gkaiseril
Level 7

15-08-2008

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.

Avatar

Avatar
Level 1
jc2046
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
jc2046
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
jc2046
Level 1

04-01-2010

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

if

(HasValue(xyz)) then

Num2Date( (Date2Num(xyz.formattedValue

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

else

null

endif

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