You are here

function availability_calendar_parse_entry_date in Availability Calendars 7.3

Same name and namespace in other branches
  1. 7.5 availability_calendar.inc \availability_calendar_parse_entry_date()
  2. 7.4 availability_calendar.inc \availability_calendar_parse_entry_date()

Parses a date string according to the - possibly localized - 'Availability Calendar date entry' date type.

Parameters

string $date:

Return value

DateTime|false A DateTime object if the date string could succesfully be parsed, false otherwise.

2 calls to availability_calendar_parse_entry_date()
availability_calendar_booking_formlet_extract_date in booking_formlet/availability_calendar_booking_formlet.module
Returns a date based on the settings and global context.
availability_calendar_handler_filter_availability::validate_valid_time_1 in ./availability_calendar_handler_filter_availability.inc

File

./availability_calendar.inc, line 181
General helper methods for Availability Calendar

Code

function availability_calendar_parse_entry_date($date) {
  $date_type = 'availability_calendar_date_entry';
  $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);
}