Solved

Comparing two dates

Posted on 2004-09-21
11
376 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus notes email code 2 119
Migration: Lotus Notes to Exchange 2013 10 325
Username format for Domino LDAP 3 78
Lotus Domino 9 web server 6 78
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now