Date
Date element for date values. This uses the browser's standard datetime picker, hence will appear slightly different on each browser.
Read View | Edit View |
---|---|
Constructor
/**
* @param $id
* @param string $label - the label of the element
* @param array $permissions - View, edit, read rights of the elemenet.
See WpooWPermissions in the Overview section.
*
**/
function __construct($id, $label, $permissions=[])
Usage example
// Declaring
$dataReviewed = new wpAPIDateTime("_dateReviewed", "Date Reviewed")
$bookReviewPostType->AddField($dataReviewed);
// Fetching Data
foreach ($bookReviewPostType->Query()->Select()->Fetch() as $row)
{
$dateBookReviewed = new DateTime($row["_dateReviewed"])
echo $dateBookReviewed->format('Y-m-d H:i:s')
}
Note:- for the WPooW Datetime element we declare it using the class wpAPIDateTime
. This is because php already has
it's own DateTime
class, which would result in a conflict between the two.