Can't understand how to compare DateTime with opCmp
Rene Zwanenburg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Feb 1 07:15:35 PST 2015
On Sunday, 1 February 2015 at 15:04:39 UTC, Suliman wrote:
> I need to compare to DateTime. I looked at docs and found opCmp
> for DateTime type.
> The problem is that I can't understand how to use it.
>
> http://dlang.org/phobos/std_datetime.html#DateTime
>
> opCmp(in DateTime rhs);
>
> what is rhs?
>
> I am trying to do something like this:
> if( DateTime.opCmp(dtindb, outoftime));
>
> But it's seems that I wrong understand how to use this
> function...
opCmp is the operator overload for the comparison operators, so
you can simple write:
if(dtindb < outoftime)
and it should work.
More information about the Digitalmars-d-learn
mailing list