本文整理汇总了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;
}