本文整理匯總了PHP中DataValidator::validate_date_format方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataValidator::validate_date_format方法的具體用法?PHP DataValidator::validate_date_format怎麽用?PHP DataValidator::validate_date_format使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataValidator
的用法示例。
在下文中一共展示了DataValidator::validate_date_format方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: canProposeThisDateTime
/**
* Checks if an event can be proposed in the given date and time
*
* @param string $date
* @param string $time
* @return TRUE on success, a ADA error code on failure
*/
public static function canProposeThisDateTime(ADALoggableUser $userObj, $date, $time, $tester = NULL)
{
$date = DataValidator::validate_date_format($date);
if ($date === FALSE) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_FORMAT;
} else {
$current_timestamp = time();
/**
* @var timezone management
*/
$offset = 0;
if ($tester === NULL) {
$tester_TimeZone = SERVER_TIMEZONE;
} else {
$tester_TimeZone = MultiPort::getTesterTimeZone($tester);
$offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
}
$timestamp_time_zone = sumDateTimeFN(array($date, "{$time}:00"));
$timestamp = $timestamp_time_zone - $offset;
if ($current_timestamp >= $timestamp) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_THE_PAST;
}
if (MultiPort::hasThisUserAnAppointmentInThisDate($userObj, $timestamp)) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_USE;
}
}
return TRUE;
}