/datemath

Simple library for evaluating ElasticSearch style date expressions.

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

datemath

Date math evaluator. godoc

Based on ElasticSearch's date math:

Syntax

[ operator ] [ number ] [ unit ]

# examples

now-3d   #  now minus 3 days
now+3h   #  now plus 3 hours
+3M      #  now + 3 months, note now is optional
+1y      #  now + 1 year

operator is either + or -. number must be an integer. The units supported are:

  • y (year)
  • M (month)
  • w (week)
  • d (date)
  • h (hour)
  • m (minute)
  • s (second)