You are here

function _scheduler_strtotime in Scheduler 6

Same name and namespace in other branches
  1. 5 scheduler.module \_scheduler_strtotime()
  2. 7 scheduler.module \_scheduler_strtotime()

Converts an english time string ('Y-m-d H:i:s') from the users timezone into an unix timestamp

Parameters

string $str the time string ('Y-m-d H:i:s'):

Return value

the time in unix timestamp representation (utc); NULL, if $str is NULL, FALSE, empty, or contains only white spaces; FALSE, if $str is malformed

2 calls to _scheduler_strtotime()
scheduler_form_alter in ./scheduler.module
Implementation of hook_form_alter().
scheduler_nodeapi in ./scheduler.module
Implementation of hook_nodeapi().

File

./scheduler.module, line 484

Code

function _scheduler_strtotime($str) {
  if ($str && trim($str) != "") {
    $date_format = variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT);
    if (_scheduler_use_date_popup()) {
      $date_format = SCHEDULER_DATE_FORMAT;
    }
    $str = trim(preg_replace('/\\s+/', ' ', $str));
    $time = _scheduler_strptime($str, $date_format);
    if ($time !== FALSE) {

      // success
      $time -= _scheduler_get_user_timezone();
    }
  }
  else {

    // $str is empty
    $time = NULL;
  }
  return $time;
}