function date_restrictions_dateobject in Date Restrictions 7
Helper to instantiate a DateObject based on $element timezone.
If a date format is given in $format, it will return the formatted date.
Return value
DateObject of string with formatted date.
4 calls to date_restrictions_dateobject()
- date_restrictions_minmax_minmax_date_popup_settings in modules/
minmax/ date_restrictions_minmax.date_restrictions.inc - Implements minmax_date_popup_settings callback.
- date_restrictions_minmax_minmax_restriction_date in modules/
minmax/ date_restrictions_minmax.date_restrictions.inc - Implements minmax_restriction_date callback.
- hook_date_restrictions_date_popup_settings in ./
date_restrictions.api.php - Javascript settings for datepicker.
- _date_restrictions_minmax_host_entity_after_build_date_popup_get_value in modules/
minmax/ date_restrictions_minmax.date_restrictions.inc - Obtain the actual value of the source field and transform as needed.
File
- ./
date_restrictions.module, line 319
Code
function date_restrictions_dateobject($date, $element, $format = NULL) {
$db_timezone = date_restrictions_db_timezone($element);
$date = new DateObject($date, $db_timezone);
date_timezone_set($date, timezone_open($element['#date_timezone']));
if ($format) {
$date = date_format_date($date, 'custom', $format);
}
return $date;
}