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