ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilDateTime Class Reference

Date and time handling More...

+ Inheritance diagram for ilDateTime:
+ Collaboration diagram for ilDateTime:

Public Member Functions

 __construct ($a_date=null, $a_format=0, $a_tz='')
 Create new date object. More...
 
 __sleep ()
 
 __wakeup ()
 
 isNull ()
 Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...) More...
 
 switchTimeZone ($a_timezone_identifier='')
 Switch timezone. More...
 
 getTimeZoneIdentifier ()
 get timezone identifier More...
 
 increment ($a_type, $a_count=1)
 increment More...
 
 getUnixTime ()
 get unix time More...
 
 getUTCOffset ()
 get UTC offset More...
 
 setDate ($a_date, $a_format)
 set date More...
 
 get ($a_format, $a_format_str='', $a_tz='')
 get formatted date More...
 
 __toString ()
 to string for date time objects Output is user time zone More...
 

Static Public Member Functions

static _before (ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
 compare two dates and check start is before end This method does not consider tz offsets. More...
 
static _equals (ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
 Check if two date are equal. More...
 
static _after (ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
 compare two dates and check start is after end This method does not consider tz offsets. More...
 
static _within (ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
 Check whether an date is within a date duration given by start and end. More...
 

Data Fields

const YEAR = 'year'
 
const MONTH = 'month'
 
const WEEK = 'week'
 
const DAY = 'day'
 
const HOUR = 'hour'
 
const MINUTE = 'minute'
 

Protected Attributes

 $log
 
 $timezone = null
 
 $default_timezone = null
 
 $unix = 0
 

Detailed Description

Date and time handling

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 32 of file class.ilDateTime.php.

Constructor & Destructor Documentation

◆ __construct()

ilDateTime::__construct (   $a_date = null,
  $a_format = 0,
  $a_tz = '' 
)

Create new date object.

public

Parameters
mixedinteger string following the format given as the second parameter
intformat of date presentation

Definition at line 60 of file class.ilDateTime.php.

References $ilLog, ilTimeZone\_getInstance(), IL_CAL_UNIX, and setDate().

61  {
62  global $ilLog;
63 
64  $this->log = $ilLog;
65 
66  try
67  {
68  $this->timezone = ilTimeZone::_getInstance($a_tz);
69  $this->default_timezone = ilTimeZone::_getInstance('');
70 
71  if(!$a_date)
72  {
73  $this->setDate(0,IL_CAL_UNIX);
74  }
75  else
76  {
77  $this->setDate($a_date,$a_format);
78  }
79  }
80  catch(ilTimeZoneException $exc)
81  {
82  $this->log->write(__METHOD__.': '.$exc->getMessage());
83  throw new ilDateTimeException('Unsupported timezone given. Timezone: '.$a_tz);
84  }
85  }
Class for DateTime exceptions.
const IL_CAL_UNIX
Class for TimeZone exceptions.
static _getInstance($a_tz='')
get instance by timezone
setDate($a_date, $a_format)
set date
+ Here is the call graph for this function:

Member Function Documentation

◆ __sleep()

ilDateTime::__sleep ( )

Definition at line 87 of file class.ilDateTime.php.

88  {
89  return array('timezone', 'default_timezone', 'unix');
90  }

◆ __toString()

ilDateTime::__toString ( )

to string for date time objects Output is user time zone

public

Parameters

Definition at line 539 of file class.ilDateTime.php.

References IL_CAL_DATETIME.

540  {
541  return $this->get(IL_CAL_DATETIME).'<br>';
542  }
const IL_CAL_DATETIME

◆ __wakeup()

ilDateTime::__wakeup ( )

Definition at line 92 of file class.ilDateTime.php.

References $ilLog.

93  {
94  global $ilLog;
95 
96  $this->log = $ilLog;
97  }

◆ _after()

static ilDateTime::_after ( ilDateTime  $start,
ilDateTime  $end,
  $a_compare_field = '',
  $a_tz = '' 
)
static

compare two dates and check start is after end This method does not consider tz offsets.

So you have to take care that both dates are defined in the the same timezone

public

Parameters
objectilDateTime
objectilDateTime
stringfield used for comparison. E.g IL_CAL_YEAR checks if start is one or more years after than end
stringtimezone

Definition at line 219 of file class.ilDateTime.php.

References get(), IL_CAL_DAY, IL_CAL_FKT_DATE, IL_CAL_MONTH, IL_CAL_UNIX, and IL_CAL_YEAR.

Referenced by ilObjGroupAccess\_registrationEnabled(), _within(), ilCalendarRecurrenceCalculator\applyLimits(), ilCalendarRecurrenceCalculator\calculateDateList(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilConsultationHourBookingTableGUI\fillRow(), ilPageObject\getActive(), ilCalendarAppointmentPanelGUI\getHTML(), ilObjCourse\getSubItems(), ilBookingEntry\isAppointmentBookableForUser(), ilECSCategoryMappingRule\matchesValue(), ilObjGroup\register(), and ilECSCategoryMappingRule\validate().

220  {
221  switch($a_compare_field)
222  {
223  case IL_CAL_YEAR:
224  return $start->get(IL_CAL_FKT_DATE,'Y',$a_tz) > $end->get(IL_CAL_FKT_DATE,'Y',$a_tz);
225 
226  case IL_CAL_MONTH:
227  return (int) $start->get(IL_CAL_FKT_DATE,'Ym',$a_tz) > $end->get(IL_CAL_FKT_DATE,'Ym',$a_tz);
228 
229  case IL_CAL_DAY:
230  return (int) $start->get(IL_CAL_FKT_DATE,'Ymd',$a_tz) > $end->get(IL_CAL_FKT_DATE,'Ymd',$a_tz);
231 
232  case '':
233  default:
234  return $start->get(IL_CAL_UNIX) > $end->get(IL_CAL_UNIX);
235 
236  }
237  }
const IL_CAL_MONTH
const IL_CAL_UNIX
const IL_CAL_DAY
const IL_CAL_FKT_DATE
get($a_format, $a_format_str='', $a_tz='')
get formatted date
const IL_CAL_YEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _before()

static ilDateTime::_before ( ilDateTime  $start,
ilDateTime  $end,
  $a_compare_field = '',
  $a_tz = '' 
)
static

compare two dates and check start is before end This method does not consider tz offsets.

So you have to take care that both dates are defined in the the same timezone

public

Parameters
objectilDateTime
objectilDateTime
stringfield used for comparison. E.g IL_CAL_YEAR checks if start is one or more years earlier than end
stringtimezone
Returns
bool

Definition at line 156 of file class.ilDateTime.php.

References get(), IL_CAL_DAY, IL_CAL_FKT_DATE, IL_CAL_MONTH, IL_CAL_UNIX, and IL_CAL_YEAR.

Referenced by ilObjGroupAccess\_registrationEnabled(), _within(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarRecurrenceCalculator\applyLimits(), ilCalendarRecurrenceCalculator\calculateDateList(), ilBookingEntry\cancelBooking(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilECSServerTableGUI\fillRow(), ilPageObject\getActive(), ilCalendarBlockGUI\getHTML(), ilObjCourse\getSubItems(), ilECSTimePlace\loadFromJson(), ilObjGroupAccess\lookupRegistrationInfo(), ilObjCourseAccess\lookupRegistrationInfo(), ilECSCategoryMappingRule\matchesValue(), ilCalendarRecurrenceCalculator\optimizeStartingTime(), ilUserQuery\query(), ilObjGroup\register(), ilStudyProgrammeAssignment\setLastChange(), ilStudyProgramme\setLastChange(), ilStudyProgrammeProgress\setLastChange(), ilCalendarMonthGUI\show(), ilCalendarPresentationGUI\synchroniseExternalCalendars(), ilObjGroup\validate(), and ilCalendarEntry\validate().

157  {
158  switch($a_compare_field)
159  {
160  case IL_CAL_YEAR:
161  return $start->get(IL_CAL_FKT_DATE,'Y',$a_tz) < $end->get(IL_CAL_FKT_DATE,'Y',$a_tz);
162 
163  case IL_CAL_MONTH:
164  return (int) $start->get(IL_CAL_FKT_DATE,'Ym',$a_tz) < $end->get(IL_CAL_FKT_DATE,'Ym',$a_tz);
165 
166  case IL_CAL_DAY:
167  return (int) $start->get(IL_CAL_FKT_DATE,'Ymd',$a_tz) < $end->get(IL_CAL_FKT_DATE,'Ymd',$a_tz);
168 
169  case '':
170  default:
171  return $start->get(IL_CAL_UNIX) < $end->get(IL_CAL_UNIX);
172 
173  }
174  }
const IL_CAL_MONTH
const IL_CAL_UNIX
const IL_CAL_DAY
const IL_CAL_FKT_DATE
get($a_format, $a_format_str='', $a_tz='')
get formatted date
const IL_CAL_YEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _equals()

static ilDateTime::_equals ( ilDateTime  $start,
ilDateTime  $end,
  $a_compare_field = '',
  $a_tz = '' 
)
static

Check if two date are equal.

public

Parameters
objectilDateTime
objectilDateTime
stringfield used for comparison. E.g IL_CAL_YEAR checks if start is the same years than end
stringtimzone

Definition at line 187 of file class.ilDateTime.php.

References get(), IL_CAL_DAY, IL_CAL_FKT_DATE, IL_CAL_MONTH, IL_CAL_UNIX, and IL_CAL_YEAR.

Referenced by ilCalendarUtil\_isToday(), _within(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarRecurrenceCalculator\calculateDateList(), ilCalendarAppointmentGUI\edit(), ilSubItemSelectionTableGUI\fillRow(), ilDatePresentation\formatPeriod(), ilDatePresentation\isToday(), ilDatePresentation\isTomorrow(), ilDatePresentation\isYesterday(), ilDateList\removeByDAY(), and ilCalendarMonthGUI\show().

188  {
189  switch($a_compare_field)
190  {
191  case IL_CAL_YEAR:
192  return $start->get(IL_CAL_FKT_DATE,'Y',$a_tz) == $end->get(IL_CAL_FKT_DATE,'Y',$a_tz);
193 
194  case IL_CAL_MONTH:
195  return (int) $start->get(IL_CAL_FKT_DATE,'Ym',$a_tz) == $end->get(IL_CAL_FKT_DATE,'Ym',$a_tz);
196 
197  case IL_CAL_DAY:
198  return (int) $start->get(IL_CAL_FKT_DATE,'Ymd',$a_tz) == $end->get(IL_CAL_FKT_DATE,'Ymd',$a_tz);
199 
200  case '':
201  default:
202  return $start->get(IL_CAL_UNIX) == $end->get(IL_CAL_UNIX);
203 
204  }
205  }
const IL_CAL_MONTH
const IL_CAL_UNIX
const IL_CAL_DAY
const IL_CAL_FKT_DATE
get($a_format, $a_format_str='', $a_tz='')
get formatted date
const IL_CAL_YEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _within()

static ilDateTime::_within ( ilDateTime  $dt,
ilDateTime  $start,
ilDateTime  $end,
  $a_compare_field = '',
  $a_tz = '' 
)
static

Check whether an date is within a date duration given by start and end.

Parameters
ilDateTime$dt
ilDateTime$start
ilDateTime$end
type$a_compare_field
type$a_tz

Definition at line 247 of file class.ilDateTime.php.

References _after(), _before(), and _equals().

Referenced by ilObjCourse\getSubItems().

248  {
249  return
250  (ilDateTime::_after($dt, $start,$a_compare_field,$a_tz) or ilDateTime::_equals($dt, $start,$a_compare_field,$a_tz)) &&
251  (ilDateTime::_before($dt, $end,$a_compare_field,$a_tz) or ilDateTime::_equals($dt, $end,$a_compare_field,$a_tz));
252  }
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get()

ilDateTime::get (   $a_format,
  $a_format_str = '',
  $a_tz = '' 
)

get formatted date

public

Parameters
intformat type
stringformat string
stringa specific timezone

Definition at line 466 of file class.ilDateTime.php.

References $default_timezone, $timezone, ilTimeZone\_getInstance(), getUnixTime(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, IL_CAL_ISO_8601, IL_CAL_TIMESTAMP, and IL_CAL_UNIX.

Referenced by _after(), _before(), _equals(), ilDatePresentation\formatDate(), ilDatePresentation\formatPeriod(), ilCalendarSchedule\getByDay(), ilObjUserGUI\getValues(), ilCalendarRecurrenceCalculator\getYearWeekDays(), ilCalendarRegistration\isRegistered(), ilUtil\period2String(), ilStudyProgrammeAssignment\setLastChange(), ilStudyProgramme\setLastChange(), ilStudyProgrammeProgress\setLastChange(), and ilCalendarRegistration\unregister().

467  {
468  if($a_tz)
469  {
470  try
471  {
473  }
474  catch(ilTimeZoneException $exc)
475  {
476  $this->log->write(__METHOD__.': Invalid timezone given. Timezone: '.$a_tz);
477  }
478  }
479  else
480  {
481  #$timezone = $this->timezone;
483  }
484 
485  switch($a_format)
486  {
487  case IL_CAL_UNIX:
488  $date = $this->getUnixTime();
489  break;
490 
491  case IL_CAL_DATE:
492  $timezone->switchTZ();
493  $date = date('Y-m-d',$this->getUnixTime());
494  $timezone->restoreTZ();
495  break;
496 
497  case IL_CAL_DATETIME:
498  $timezone->switchTZ();
499  $date = date('Y-m-d H:i:s',$this->getUnixTime());
500  $timezone->restoreTZ();
501  break;
502 
503  case IL_CAL_FKT_DATE:
504  $timezone->switchTZ();
505  $date = date($a_format_str,$this->getUnixTime());
506  $timezone->restoreTZ();
507  break;
508 
509  case IL_CAL_FKT_GETDATE:
510  $timezone->switchTZ();
511  $date = getdate($this->getUnixTime());
512  $timezone->restoreTZ();
513 
514  // add iso 8601 week day number (Sunday = 7)
515  $date['isoday'] = $date['wday'] == 0 ? 7 : $date['wday'];
516  break;
517 
518  case IL_CAL_ISO_8601:
519  $date = date('c',$this->getUnixTime());
520  break;
521 
522  case IL_CAL_TIMESTAMP:
523  $timezone->switchTZ();
524  $date = date('YmdHis',$this->getUnixTime());
525  $timezone->restoreTZ();
526  break;
527  }
528  return $date;
529  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
Class for TimeZone exceptions.
const IL_CAL_FKT_DATE
const IL_CAL_ISO_8601
const IL_CAL_FKT_GETDATE
static _getInstance($a_tz='')
get instance by timezone
getUnixTime()
get unix time
const IL_CAL_DATE
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeZoneIdentifier()

ilDateTime::getTimeZoneIdentifier ( )

get timezone identifier

public

Definition at line 137 of file class.ilDateTime.php.

138  {
139  return $this->timezone->getIdentifier();
140  }

◆ getUnixTime()

ilDateTime::getUnixTime ( )

get unix time

public

Definition at line 308 of file class.ilDateTime.php.

References $unix.

Referenced by get().

309  {
310  return $this->unix;
311  }
+ Here is the caller graph for this function:

◆ getUTCOffset()

ilDateTime::getUTCOffset ( )

get UTC offset

public

Returns
offset to utc in seconds

Definition at line 320 of file class.ilDateTime.php.

321  {
322  $this->timezone->switchTZ();
323  // TODO: This is wrong: calculate UTC offset of given date
324  $offset = mktime(0,0,0,2,1,1970) - gmmktime(0,0,0,2,1,1970);
325  $this->timezone->restoreTZ();
326  return $offset;
327  }

◆ increment()

ilDateTime::increment (   $a_type,
  $a_count = 1 
)

increment

public

Parameters
inttype
intcount

Definition at line 262 of file class.ilDateTime.php.

References $d, $unix, and IL_CAL_UNIX.

Referenced by ilCalendarSchedule\getByDay(), ilCalendarSchedule\initPeriod(), ilDatePresentation\isTomorrow(), ilDatePresentation\isYesterday(), and ilICalParser\writeEvent().

263  {
264  $count_str = $a_count > 0 ? ('+'.$a_count.' ') : ($a_count.' ');
265 
266  $this->timezone->switchTZ();
267  switch($a_type)
268  {
269  case self::YEAR:
270  $this->unix = strtotime($count_str.'year',$this->unix);
271  break;
272 
273  case self::MONTH:
274  $this->unix = strtotime($count_str.'month',$this->unix);
275  break;
276 
277  case self::WEEK:
278  $this->unix = strtotime($count_str.'week',$this->unix);
279  break;
280 
281  case self::DAY:
282  $this->unix = strtotime($count_str.'day',$this->unix);
283  break;
284 
285  case self::HOUR:
286  $this->unix = strtotime($count_str.'hour',$this->unix);
287  break;
288 
289  case self::MINUTE:
290 
291  $this->unix = strtotime($count_str.'minute',$this->unix);
292  $d = new ilDateTime($this->unix,IL_CAL_UNIX);
293 
294 
295  break;
296 
297  }
298  $this->timezone->restoreTZ();
299  return $this->unix;
300  }
const IL_CAL_UNIX
Date and time handling
+ Here is the caller graph for this function:

◆ isNull()

ilDateTime::isNull ( )

Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)

Returns
bool

Definition at line 105 of file class.ilDateTime.php.

Referenced by ilDatePresentation\formatDate().

106  {
107  return $this->unix ? false : true;
108  }
+ Here is the caller graph for this function:

◆ setDate()

ilDateTime::setDate (   $a_date,
  $a_format 
)

set date

public

Parameters
mixeddate
intformat

Definition at line 337 of file class.ilDateTime.php.

References $timezone, $unix, ilTimeZone\_getInstance(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_FKT_GETDATE, IL_CAL_ISO_8601, IL_CAL_TIMESTAMP, and IL_CAL_UNIX.

Referenced by __construct(), ilUserProfile\addStandardFieldsToForm(), arEditGUI\afterFillForm(), ilExAssignmentEditorGUI\getAssignmentValues(), ilExAssignmentEditorGUI\getPeerReviewValues(), and ilExAssignmentEditorGUI\setDisabledFieldValues().

338  {
339  switch($a_format)
340  {
341  case IL_CAL_UNIX:
342  $this->unix = $a_date;
343  break;
344 
345  case IL_CAL_DATETIME:
346  $matches = preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)$/i',$a_date,$d_parts);
347  if($matches < 1)
348  {
349  $this->log->write(__METHOD__.': Cannot parse date: '.$a_date);
350  $this->log->write(__METHOD__.': '.print_r($matches,true));
351  $this->log->logStack();
352  throw new ilDateTimeException('Cannot parse date.');
353  }
354 
355  // UTC designator
356  if($d_parts[9] == 'Z')
357  {
358  $utc = ilTimeZone::_getInstance('UTC');
359  $utc->switchTZ();
360  }
361  else
362  {
363  $this->timezone->switchTZ();
364  }
365  $this->unix = mktime(
366  isset($d_parts[5]) ? $d_parts[5] : 0,
367  isset($d_parts[6]) ? $d_parts[6] : 0,
368  isset($d_parts[7]) ? $d_parts[7] : 0,
369  $d_parts[2],
370  $d_parts[3],
371  $d_parts[1]);
372 
373  if($d_parts[0] == '0000-00-00 00:00:00')
374  {
375  $this->unix = 0;
376  }
377 
378  if($d_parts[9] == 'Z')
379  {
380  $utc->restoreTZ();
381  }
382  else
383  {
384  $this->timezone->restoreTZ();
385  }
386  break;
387 
388  case IL_CAL_DATE:
389  // Pure dates are not timezone sensible.
391  $timezone->switchTZ();
392  $unix = strtotime($a_date);
393  $timezone->restoreTZ();
394  if($unix === false)
395  {
396  $this->log->write(__METHOD__.': Cannot parse date : '.$a_date);
397  $this->unix = 0;
398  return false;
399  }
400  $this->unix = $unix;
401  break;
402 
403  case IL_CAL_FKT_GETDATE:
404  if (!isset($a_date['seconds']))
405  {
406  $a_date['seconds'] = false;
407  }
408  // Format like getdate parameters
409  $this->timezone->switchTZ();
410  $this->unix = mktime(
411  $a_date['hours'],
412  $a_date['minutes'],
413  $a_date['seconds'],
414  $a_date['mon'],
415  $a_date['mday'],
416  $a_date['year']);
417  $this->timezone->restoreTZ();
418 
419  // TODO: choose better error handling
420  if(!$a_date['year'])
421  {
422  $this->unix = 0;
423  }
424  break;
425 
426  case IL_CAL_TIMESTAMP:
427  if(preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $a_date,$d_parts) == false)
428  {
429  $this->log->write(__METHOD__.': Cannot parse date: '.$a_date);
430  throw new ilDateTimeException('Cannot parse date.');
431  }
432  $this->timezone->switchTZ();
433  $this->unix = mktime(
434  isset($d_parts[4]) ? $d_parts[4] : 0,
435  isset($d_parts[5]) ? $d_parts[5] : 0,
436  isset($d_parts[6]) ? $d_parts[6] : 0,
437  $d_parts[2],
438  $d_parts[3],
439  $d_parts[1]);
440 
441  if($d_parts[0] == '00000000000000' or
442  $d_parts[0] == '00000000')
443  {
444  $this->unix = 0;
445  }
446  $this->timezone->restoreTZ();
447  break;
448 
449  case IL_CAL_ISO_8601:
450  $dt = DateTime::createFromFormat(DateTime::ISO8601, $a_date);
451  $this->unix = $dt->getTimeStamp();
452  break;
453 
454  }
455  return true;
456  }
const IL_CAL_DATETIME
Class for DateTime exceptions.
const IL_CAL_UNIX
const IL_CAL_ISO_8601
const IL_CAL_FKT_GETDATE
static _getInstance($a_tz='')
get instance by timezone
const IL_CAL_DATE
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchTimeZone()

ilDateTime::switchTimeZone (   $a_timezone_identifier = '')

Switch timezone.

public

Parameters
stringPHP timezone identifier
Exceptions
ilDateTimeException

Definition at line 117 of file class.ilDateTime.php.

References ilTimeZone\_getInstance().

Referenced by ilCalendarRecurrenceCalculator\adjustTimeZones().

118  {
119  try
120  {
121  $this->timezone = ilTimeZone::_getInstance($a_timezone_identifier);
122  return true;
123  }
124  catch(ilTimeZoneException $e)
125  {
126  $this->log->write('Unsupported timezone given: '.$a_timezone_identifier);
127  throw new ilDateTimeException('Unsupported timezone given. Timezone: '.$a_timezone_identifier);
128  }
129  }
Class for DateTime exceptions.
Class for TimeZone exceptions.
static _getInstance($a_tz='')
get instance by timezone
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $default_timezone

ilDateTime::$default_timezone = null
protected

Definition at line 44 of file class.ilDateTime.php.

Referenced by get().

◆ $log

ilDateTime::$log
protected

Definition at line 41 of file class.ilDateTime.php.

◆ $timezone

ilDateTime::$timezone = null
protected

Definition at line 43 of file class.ilDateTime.php.

Referenced by get(), and setDate().

◆ $unix

ilDateTime::$unix = 0
protected

Definition at line 46 of file class.ilDateTime.php.

Referenced by getUnixTime(), increment(), and setDate().

◆ DAY

◆ HOUR

const ilDateTime::HOUR = 'hour'

Definition at line 38 of file class.ilDateTime.php.

Referenced by ilConsultationHoursGUI\createAppointments().

◆ MINUTE

const ilDateTime::MINUTE = 'minute'

Definition at line 39 of file class.ilDateTime.php.

Referenced by ilConsultationHoursGUI\createAppointments().

◆ MONTH

◆ WEEK

◆ YEAR


The documentation for this class was generated from the following file: