Logo

Programming-Idioms

  • Pascal
  • Rust
  • Groovy

Idiom #115 Compare dates

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

boolean b = d1.before(d2)
uses dateutils;
b := (CompareDateTime(d1,d2) = -1);
extern crate chrono;
use chrono::prelude::*;
let b = d1 < d2;
bool b = d1 < d2;

New implementation...
< >
programming-idioms.org