Logo

Programming-Idioms

  • Go

Idiom #115 Compare dates

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

import std.datetime;
bool b = d1 < d2;

d1, d2 have type Date.
import "time"
b := d1.Before(d2)

d1, d2 have type time.Time.
bool b = d1 < d2;

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