24 include_once(
'./Services/Calendar/classes/class.ilDate.php');
25 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
52 self::$use_relative_dates = $a_status;
63 return self::$use_relative_dates;
100 self::setLanguage($lng);
101 self::setUseRelativeDates(
true);
119 return self::getLanguage()->txt(
'no_date');
122 $has_time = !is_a($date,
'ilDate');
135 if(self::isToday($date)
and self::useRelativeDates())
137 $date_str = self::getLanguage()->txt(
'today');
139 elseif(self::isTomorrow($date)
and self::useRelativeDates())
141 $date_str = self::getLanguage()->txt(
'tomorrow');
143 elseif(self::isYesterday($date)
and self::useRelativeDates())
145 $date_str = self::getLanguage()->txt(
'yesterday');
149 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
160 switch($ilUser->getTimeFormat())
186 $has_time = !is_a($start,
'ilDate');
193 return self::formatDate($start);
197 $date_str = self::formatDate(
203 switch($ilUser->getTimeFormat())
214 switch($ilUser->getTimeFormat())
217 return $date_str.
', '.$start->
get(
IL_CAL_FKT_DATE,
'H:i',$ilUser->getTimeZone()).
' - '.
221 return $date_str.
', '.$start->
get(
IL_CAL_FKT_DATE,
'g:ia',$ilUser->getTimeZone()).
' - '.
228 return self::formatDate($start).
' - '.self::formatDate($end);
245 if(!is_object(self::$today))
264 if(!is_object(self::$yesterday))
285 if(!is_object(self::$tomorrow))
303 public static function secondsToString($seconds, $force_with_seconds =
false, $a_lng = null)
312 $seconds = $seconds ? $seconds : 0;
317 $days = floor($seconds / 86400);
318 $rest = $seconds % 86400;
320 $hours = floor(
$rest / 3600);
323 $minutes = floor(
$rest / 60);
324 $seconds =
$rest % 60;
328 $days = ceil($seconds / 86400);
329 $rest = $seconds % 86400;
331 $hours = ceil(
$rest / 3600);
334 $minutes = ceil(
$rest / 60);
335 $seconds =
$rest % 60;
340 $message = $days .
' '. ($days == 1 ? $lng->txt(
'day') : $lng->txt(
'days'));
348 $message .= ($hours .
' '. ($hours == 1 ? $lng->txt(
'hour') : $lng->txt(
'hours')));
356 $message .= ($minutes .
' '. ($minutes == 1 ? $lng->txt(
'minute') : $lng->txt(
'minutes')));
358 if($force_with_seconds && $seconds)
364 $message .= ($seconds .
' '. ($seconds == 1 ? $lng->txt(
'second') : $lng->txt(
'seconds')));
366 if(!$days
and !$hours
and !$minutes)
368 return $seconds .
' '. ($seconds == 1 ? $lng->txt(
'second') : $lng->txt(
'seconds'));
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static resetToDefaults()
reset to defaults
static setUseRelativeDates($a_status)
set use relative dates
static isToday(ilDateTime $date)
Check if date is "today".
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
static useRelativeDates()
check if relative dates are used
static setLanguage($a_lng)
set language
Class for date presentation.
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static $use_relative_dates
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static isYesterday(ilDateTime $date)
Check if date is yesterday.
static formatDate(ilDateTime $date)
Format a date public.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
increment($a_type, $a_count=1)
increment
static isTomorrow(ilDateTime $date)
Check if date is tomorrow.
static getLanguage()
set language
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
isNull()
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)