Comparing Dates

A little new at this and could use a hand. I am trying to compare two dates to see if one date is after the other. That is easy enough.

What I need to do is compare the dates and see if the one date is more than a day after the other.

For example:

06/30/04 and 07/01/04 Would be a no because July first is not more than a day past June 30.

06/30/04 and 07/02/04 would be a yes because July second is more than a day past June 30.

I know I can use @Day to exrtact the day, but then there are issues with the begining of the month and the end of the month.

Any ideas?

Subject: RE: Comparing Dates

To see whether date1 is more than a day later than date2:

@Adjust(date1; 0; 0; -1; 0; 0; 0) > date2

Note, however, if the dates contain time values, DST issues may come into play. In that case, depending what your intent is, you may want to adjust date1 by 24 hours instead of 1 day.

Are you the Mike Tharp, famous in story and song?

Subject: RE: Comparing Dates

That solution works perfectly, thank you!

Haven’t heard the story or the song, but I will take the fame…if it’s good.

Subject: If they are truely Date/Time fields, then just compare them…

i.e.@If(StartDate > EndDate; @Failure(“You can’t start the event after it Ends”); @Success)

Subject: Comparing Dates

For something this simple, you don’t need to worry about too many of the details of working with dates.

Formula:

@if((EndDate - StartDate) > 86400; “More than one day later”; “Earlier than or less than one full day later”)

LS:

if doc.enddate(0) - doc.startdate(0) > 1 then