本文整理匯總了PHP中ilDateTime::isNull方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilDateTime::isNull方法的具體用法?PHP ilDateTime::isNull怎麽用?PHP ilDateTime::isNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilDateTime
的用法示例。
在下文中一共展示了ilDateTime::isNull方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setDate
public function setDate(ilDateTime $a_value = null)
{
if ($a_value && $a_value->isNull()) {
$a_value = null;
}
$this->value = $a_value;
}
示例2: formatDate
/**
* Format a date
* @access public
* @param object $date ilDate or ilDateTime
* @return string date presentation in user specific timezone and language
* @static
*/
public static function formatDate(ilDateTime $date)
{
global $lng, $ilUser;
if ($date->isNull()) {
return self::getLanguage()->txt('no_date');
}
$has_time = !is_a($date, 'ilDate');
// Converting pure dates to user timezone might return wrong dates
if ($has_time) {
$date_info = $date->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone());
} else {
$date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
}
if (self::isToday($date) and self::useRelativeDates()) {
$date_str = self::getLanguage()->txt('today');
} elseif (self::isTomorrow($date) and self::useRelativeDates()) {
$date_str = self::getLanguage()->txt('tomorrow');
} elseif (self::isYesterday($date) and self::useRelativeDates()) {
$date_str = self::getLanguage()->txt('yesterday');
} else {
include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
$date_str = $date->get(IL_CAL_FKT_DATE, 'd') . '. ' . ilCalendarUtil::_numericMonthToString($date_info['mon'], false) . ' ' . $date_info['year'];
}
if (!$has_time) {
return $date_str;
}
switch ($ilUser->getTimeFormat()) {
case ilCalendarSettings::TIME_FORMAT_24:
return $date_str . ', ' . $date->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
case ilCalendarSettings::TIME_FORMAT_12:
return $date_str . ', ' . $date->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
}
}