Skip to main content

parse_human_date

Function parse_human_date 

Source
pub fn parse_human_date(input: &str) -> Result<String, Error>
Expand description

Parse a human-readable date string into a SQLite datetime string.

Supports a wide variety of formats including:

  • SQLite datetime format: “2026-01-28 12:00:00” (passed through)
  • ISO 8601: “2026-01-28T12:00:00Z”
  • Relative past: “2 days ago”, “1 week ago”, “3 hours ago”
  • Relative future: “in 2 days”, “in 1 week”
  • Named: “today”, “yesterday”, “tomorrow”, “now”
  • And many more formats supported by the parse_datetime crate

Returns an error if the string cannot be parsed.