You are here

function start_date_load in Booking and Availability Management Tools for Drupal 7

Loads a DateTime object from a string.

Parameters

string $start_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 170

Code

function start_date_load($start_date) {
  $start_date = check_plain($start_date);
  try {
    $sd = new DateTime($start_date);
  } catch (Exception $e) {
    $sd = 0;
  }
  return $sd;
}