function availability_calendar_parse_display_date in Availability Calendars 7.3
Same name and namespace in other branches
- 7.5 availability_calendar.inc \availability_calendar_parse_display_date()
- 7.4 availability_calendar.inc \availability_calendar_parse_display_date()
Parses a date string according to the - possibly localized - 'Availability Calendar date display' date type.
Parameters
string $date:
Return value
DateTime|false A DateTime object if the date string could succesfully be parsed, false otherwise.
File
- ./
availability_calendar.inc, line 164 - General helper methods for Availability Calendar
Code
function availability_calendar_parse_display_date($date) {
$date_type = 'availability_calendar_date_display';
$format = variable_get("date_format_{$date_type}", '');
// Date API works in PHP5.2, DateTime::createFromFormat in PHP >= 5.3.
return module_exists('date_api') ? new DateObject($date, NULL, $format) : DateTime::createFromFormat($format, $date);
}