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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Increment dates

Avatar

Level 2

Working on a form that's sort of a timesheet.  How would I fill in other fields based on an initial date ??  IE: Field-A, a date/time field gets filled in.  I'd then like to automatically fill in another 13 fields for the time period with dates based off Field-A. In advance - many thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Presume that your Date field has the value pattern as DD/MM/YYYY

You can convert it's rawvalue into number of days using the following script in FormCalc

var firstDate = Date2Num(DateField1.rawValue,"DD/MM/YYYY")

now firstDate will have the number of days since epoch.

Next step you can add 1 to the firstDate and convert it back into Date Object using the following syntax

secondDateField.rawValue =  Num2Date(firstDate,"DD/MM/YYYY")

Similarly you can do it for all 13 date fields.

Nith

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Presume that your Date field has the value pattern as DD/MM/YYYY

You can convert it's rawvalue into number of days using the following script in FormCalc

var firstDate = Date2Num(DateField1.rawValue,"DD/MM/YYYY")

now firstDate will have the number of days since epoch.

Next step you can add 1 to the firstDate and convert it back into Date Object using the following syntax

secondDateField.rawValue =  Num2Date(firstDate,"DD/MM/YYYY")

Similarly you can do it for all 13 date fields.

Nith

Avatar

Level 2

Sweet.

Thank you.

John Rojowski

DFAS/IND DJMS-AC SIT

Phone:  317-212-7470

"Simplify."