Skip to content
Richard edited this page Jun 16, 2016 · 1 revision

Dates

Maphper uses the inbuilt PHP \DateTime class to store and search by dates:

$blog = new stdClass;
$blog->title = 'A blog entry';

//You can construct the date object using any of the formats availble in the inbuilt PHP datetime class
$blog->date = new \DateTime('2015-11-14');

This can also be used in filters:

//Find all blogs posted on 2015-11-14
$maphper->filter(['date' => new \DateTime('2015-11-14')]);

It is recommended to use the DateTime class rather than passing the date value as a string as not all mappers will use the same internal date format

Clone this wiki locally