You are here

function end_date_load in Booking and Availability Management Tools for Drupal 7

Loads a DateTime object from a string.

Parameters

string $end_date: Expects to see a date in the form Y-m-d.

Return value

DateTime Object or null if invalid

File

modules/bat_booking/bat_booking_example/bat_booking_example.module, line 192

Code

function end_date_load($end_date) {
  $end_date = check_plain($end_date);
  try {
    $ed = new DateTime($end_date);
  } catch (Exception $e) {
    $ed = 0;
  }
  return $ed;
}