Solved

Comparing two dates

Posted on 2004-09-21
11
375 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

21 Experts available now in Live!

Get 1:1 Help Now