selzlerb Posted March 12, 2009 Posted March 12, 2009 Hello Team, I need to compare two dates and determine which is the "newer" date. For example, I have a field called "ExitDate". I need to compare whatever the date is in ExitDate, which may be June 19, 2009, and compare it with todays date and determine which is "newer" and place the result in a field. I can't see how to create what must be an "if/then" statement of some sort. Let me know what you think. - Sez
comment Posted March 12, 2009 Posted March 12, 2009 Assuming ExitDate is a date field: Case ( Get (CurrentDate) > ExitDate ; "Expired" ; "Not yet" ) Or: Choose ( 1 + Sign ( Get (CurrentDate) - ExitDate ) ; "Future" ; "Today" ; "Past" )
David Jondreau Posted March 12, 2009 Posted March 12, 2009 GetAsDate(Max(ExitDate; Get(CurrentDate)))
comment Posted March 12, 2009 Posted March 12, 2009 Oh, was THAT the question? BTW, if the result is date, then GetAsDate() is not required.
selzlerb Posted March 12, 2009 Author Posted March 12, 2009 Hello Team, First, thanks for such a quick reply! This really SMA! I used the following; GetAsDate(Min(ExitDate; Get(CurrentDate))) In a calculation field substituting Min for Max and its a perfect solution. Thank you. If I understand this correctly it is saying; "Return a date - the "earliest" of the following two dates - exitdate and todays date." This way, if there is a date in the exit date field that is earlier than todays date, it leaves it alone. Which is exactly what I'm looking for. Again, thank you. I think the other code posted here is interesting as well, and can see other applications for the concept. I will take note of it. - Sez
Recommended Posts
This topic is 5794 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now