Function to return an SQL datetime expression that can be used with Postgres used for querying a datetime addition
Signature
public function datetimeIntervalClause(string
$date,
string
$interval )
Parameters
$date
—
string
can be either 'now', literal datetime like '1973-10-14 10:30:00' or field name, e.g. '"SiteTree"."Created"'
$interval
—
string
to be added, use the format [sign][integer] [qualifier], e.g. -1 Day, +15 minutes, +1 YEAR supported qualifiers: - years - months - days - hours - minutes - seconds This includes the singular forms as well
Returns
string
SQL datetime expression to query for a datetime (YYYY-MM-DD hh:mm:ss) which is the result of the addition