This content has been marked as final. Show 5 replies
Yes, you have to use the Date2Numb() function to get the number of days from the date strings. You have to make sure you get the format of the input date strings correct or this will not work.
I attempted to input the calculation you are suggesting and it won't work . . .
I have two fields . . . "DateofRequest" that customer must enter and then "DateRequired" which the customer must also enter. I created a separate field to calculate the difference in days between the two dates. This is what I attempted:
Date2Numb(dateofrequest,daterequired) . . . what am I doing wrong . . . this is driving me crazy . . . thanks!!!
Did you read the documentation on the Date2Num function? You are not passing it the correct parameters.
DateTimeField3.rawValue = Date2Num(DateRequired.rawValue, "YYYY-MM-DD") - Date2Num(DateofRequest.rawValue, "YYYY-MM-DD")
You'll need to replace "DateTimeField3" with the name of your output field.
You also have to the correct date string format for the rawValue or formattedValue.
Yes, my example just uses the default format. If you've changed yours, you will need to modify the code to include that format.