public function DatexObject::objectFromDate in Datex 7.2
Created datex object from a localized date.
The only way to create an object from localized date is using an array, Other type of dates have no difference in localized format such as timestamp. String are not supported yet till parser() is fully implemented.
1 call to DatexObject::objectFromDate()
- DatexObject::setDatetime in datex_api/
datex_api.class.inc - Set date-time of object instance by extracting timestamp from given date.
File
- datex_api/
datex_api.class.inc, line 611 - Provides an API to work with dates.
Class
- DatexObject
- Base class for localized DateTime.
Code
public function objectFromDate($date, $tz = NULL) {
if (is_array($date)) {
foreach (array(
'year',
'month',
'day',
) as $name) {
if (!isset($date[$name])) {
$date[$name] = 0;
}
}
list($date['year'], $date['month'], $date['day']) = $this
->toGregorian($date['year'], $date['month'], $date['day']);
}
return $this
->xobjectFromDate($date, $tz);
}