approxidate()

approxidate()#

The approxidate function interprets a human-readable date string and converts it into a timestamp. It supports various date formats, including absolute dates, relative dates, and special keywords.

Prototype

timestamp_t approxidate(const char *date);

Parameters

Key

Type

Description

date

const char *

A human-readable date string that can include absolute dates (e.g., ‘2024-09-17’), relative dates (e.g., ‘3 days ago’), or special keywords (e.g., ‘yesterday’, ‘now’).


Return Value

Returns a timestamp_t representing the parsed date as a Unix timestamp. If parsing fails, it returns TIME_MAX.

Notes

This function is useful for parsing flexible date inputs in applications that require user-friendly date handling. It internally calls approxidate_careful() to process the input string.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples