Logo

Programming-Idioms

Set boolean b to true if date d1 is strictly before date d2 ; false otherwise.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
bool b = d1 < d2;
import std.datetime;
bool b = d1 < d2;
bool b = d1.isBefore(d2);
import "time"
b := d1.Before(d2)
boolean b = d1.before(d2)
import Data.Time.Calendar
b = d1 < d2
let b = d1 < d2
import java.util.Date;
boolean before = (d1.compareTo(d2) == -1);
$d1 = new DateTime('January 25 2016');
$d2 = new DateTime('January 26 2016');

$b = $d1 < $d2;
uses dateutils;
b := (CompareDateTime(d1,d2) = -1);
my $b = d1 < d2;
import datetime
b = d1 < d2
b = d1 < d2
extern crate chrono;
use chrono::prelude::*;
let b = d1 < d2;