?
Solved

Comparing two dates

Posted on 2004-09-21
11
Medium Priority
?
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

771 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