Solved

Comparing two dates

Posted on 2004-09-21
11
377 Views
Last Modified: 2013-12-18
This do not work:

@If(Date1 < Date2: Date1)

I checked the Help files...  Don't know if the @Compare should be better, anyway, I don't understand how the @Compare command works!
0
Comment
Question by:barbotte
11 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 12112132
Try putting @texttotime around the formula

i.e @if (@texttotime(date1)<@texttotime(date2);Date1;"")

Partha
0
 

Author Comment

by:barbotte
ID: 12112167
ERROR: Incorrect data atype for operator or @Function

I've put:

@If(@TextToTime(Date1) < @TextToTime(Date2): Date1)
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12112180
what is that ":", use semicolon and also check whether date1 or date2 is null

Partha
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:barbotte
ID: 12112193
This doesn't work either

@If(@TextToTime(Date1) < @TextToTime(Date2); Date2;"")
0
 

Author Comment

by:barbotte
ID: 12112204
There's a value in each Date1 and Date2 fields (field type: Date/Type)
0
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 50 total points
ID: 12112206
An @if statement needs 3 parts, first the condition, then the "true" case, then the "false" case

@If(Date1 < Date2; Date1; Date2)

cheers,

Tom
0
 

Author Comment

by:barbotte
ID: 12112209
oops, Date/Time I meant
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12112221
Where have you written this formula

partha
0
 

Author Comment

by:barbotte
ID: 12112271
Bozzie4 solutions works!

Thanx!
0
 

Author Comment

by:barbotte
ID: 12112291
I was writing the condition in the formula zone of a column in a view
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12112338
Please check that:

1) Date1 is a date field
2) Ditto Date2
3) Each of them has a VALID date in the field

Also, what are you trying to accomplish?  Usually, you use @if thusly: @If(condition; value_if_condition_true; value_if_condition_false)

You have condition as: Date1 < Date2 : Date1
But you don't have either of the value_if_condition_xx sections.

Perhaps you meant:
If Date1 < Date2
    Then Use Date1
    Otherwise, use Date2

That would be: @If(Date1<Date2; Date1; Date2)

But date1 and date2 would still have to be two valid dates in a adate field.  Neither one can be blank.  If you need to account for blanks, use:
@If(Date1 = ""; Date2; Date2= ""; Date1; Date1<Date2; Date1; Date2)

That says:
If date1 is blank
    Then use date2
Otherwise, if date2 is blank
    Then use date1
Otherwise, if date1 is less than date2
    Then use date1
Otherwise, in any case,
    Use date2
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question