Expand my Community achievements bar.

How do I compare dates?

Avatar

Level 4

Hello!

I have 2 field. The first there is current date and second there is date fill by user.

I want to compare the two dates and I want that return how many days of different. Is it possible?

Example:

06/15/2010 compared with 06/20/2010 result = 5 days

Thanks!

3 Replies

Avatar

Level 9

Hello Rafael ,

You have to use Date2Num functions Here . Suppose you have two Date fields as Date1 , Date2 , You have a text field where you have to show the difference of the days . You may a need a button where you can put the following scripts .

TextField1..rawValue =((Date2Num(Date1.rawValue, "YYYY-MM-DD")) - (Date2Num(Date2.rawValue, "YYYY-MM-DD")))

You have to put the script in the click event of the button using the FormCalc .

Hope it helps .

Thanks .

Bibhu.

Avatar

Level 4

Yeahh! It works!!

Thank so much dude!!!