ILIAS
Release_4_0_x_branch Revision 61816
|
Date and time handling More...
Public Member Functions | |
__construct ($a_date=null, $a_format=0, $a_tz= '') | |
Create new date object. | |
isNull () | |
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...) | |
switchTimeZone ($a_timezone_identifier= '') | |
Switch timezone. | |
getTimeZoneIdentifier () | |
get timezone identifier | |
increment ($a_type, $a_count=1) | |
increment | |
getUnixTime () | |
get unix time | |
getUTCOffset () | |
get UTC offset | |
setDate ($a_date, $a_format) | |
set date | |
get ($a_format, $a_format_str= '', $a_tz= '') | |
get formatted date | |
__toString () | |
to string |
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. | |
static | _equals (ilDateTime $start, ilDateTime $end, $a_compare_field= '', $a_tz= '') |
Check if two date are equal. | |
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. |
Data Fields | |
const | YEAR = 'year' |
const | MONTH = 'month' |
const | WEEK = 'week' |
const | DAY = 'day' |
const | HOUR = 'hour' |
Protected Attributes | |
$log | |
$timezone = null | |
$default_timezone = null | |
$unix = 0 |
ilDateTime::__construct | ( | $a_date = null , |
|
$a_format = 0 , |
|||
$a_tz = '' |
|||
) |
Create new date object.
public
mixed | integer string following the format given as the second parameter |
int | format of date presentation |
@throws | ilDateTimeException |
Definition at line 77 of file class.ilDateTime.php.
References $ilLog, ilTimeZone\_getInstance(), IL_CAL_UNIX, and setDate().
ilDateTime::__toString | ( | ) |
to string
public
@return |
Definition at line 502 of file class.ilDateTime.php.
References IL_CAL_DATETIME.
|
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
object | ilDateTime |
object | ilDateTime |
string | field used for comparison. E.g IL_CAL_YEAR checks if start is one or more years after than end |
string | timezone |
Definition at line 223 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 ilCalendarRecurrenceCalculator\applyLimits(), ilCalendarRecurrenceCalculator\calculateDateList(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilPageObject\getActive(), ilECSCategoryMappingRule\matchesValue(), and ilECSCategoryMappingRule\validate().
|
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
object | ilDateTime |
object | ilDateTime |
string | field used for comparison. E.g IL_CAL_YEAR checks if start is one or more years earlier than end |
string | timezone |
Definition at line 160 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 ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarRecurrenceCalculator\applyLimits(), ilCalendarRecurrenceCalculator\calculateDateList(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilPageObject\getActive(), ilECSCategoryMappingRule\matchesValue(), ilCalendarRecurrenceCalculator\optimizeStartingTime(), ilCalendarMonthGUI\show(), ilObjGroup\validate(), and ilCalendarEntry\validate().
|
static |
Check if two date are equal.
public
object | ilDateTime |
object | ilDateTime |
string | field used for comparison. E.g IL_CAL_YEAR checks if start is the same years than end |
string | timzone |
Definition at line 191 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(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarRecurrenceCalculator\calculateDateList(), ilSubItemSelectionTableGUI\fillRow(), ilDatePresentation\formatPeriod(), ilDatePresentation\isToday(), ilDatePresentation\isTomorrow(), ilDatePresentation\isYesterday(), and ilCalendarMonthGUI\show().
ilDateTime::get | ( | $a_format, | |
$a_format_str = '' , |
|||
$a_tz = '' |
|||
) |
get formatted date
public
int | format type |
string | format string |
string | a specific timezone |
Definition at line 434 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_TIMESTAMP, and IL_CAL_UNIX.
Referenced by _after(), _before(), _equals(), ilDateDurationInputGUI\checkInput(), ilDatePresentation\formatDate(), ilDatePresentation\formatPeriod(), ilCalendarSchedule\getByDay(), ilObjUserGUI\getValues(), ilCalendarRecurrenceCalculator\getYearWeekDays(), ilObjUserGUI\saveObject(), and ilObjUserGUI\updateObject().
ilDateTime::getTimeZoneIdentifier | ( | ) |
get timezone identifier
public
Definition at line 141 of file class.ilDateTime.php.
ilDateTime::getUnixTime | ( | ) |
get unix time
public
Definition at line 304 of file class.ilDateTime.php.
References $unix.
Referenced by get().
ilDateTime::getUTCOffset | ( | ) |
get UTC offset
public
Definition at line 316 of file class.ilDateTime.php.
ilDateTime::increment | ( | $a_type, | |
$a_count = 1 |
|||
) |
increment
public
int | type |
int | count |
Definition at line 251 of file class.ilDateTime.php.
References $unix, and IL_CAL_FKT_DATE.
Referenced by ilCalendarSchedule\getByDay(), ilCalendarSchedule\initPeriod(), ilDatePresentation\isTomorrow(), and ilDatePresentation\isYesterday().
ilDateTime::isNull | ( | ) |
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)
Definition at line 109 of file class.ilDateTime.php.
Referenced by ilDatePresentation\formatDate().
ilDateTime::setDate | ( | $a_date, | |
$a_format | |||
) |
set date
public
mixed | date |
int | format |
Definition at line 333 of file class.ilDateTime.php.
References $timezone, $unix, ilTimeZone\_getInstance(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_FKT_GETDATE, IL_CAL_TIMESTAMP, and IL_CAL_UNIX.
Referenced by __construct(), ilUserProfile\addStandardFieldsToForm(), ilObjExerciseGUI\getPropertiesValues(), and ilObjCourseGUI\initForm().
ilDateTime::switchTimeZone | ( | $a_timezone_identifier = '' | ) |
Switch timezone.
public
string | PHP timezone identifier |
ilDateTimeException |
Definition at line 121 of file class.ilDateTime.php.
References ilTimeZone\_getInstance().
Referenced by ilCalendarRecurrenceCalculator\adjustTimeZones().
|
protected |
Definition at line 61 of file class.ilDateTime.php.
Referenced by get().
|
protected |
Definition at line 58 of file class.ilDateTime.php.
|
protected |
Definition at line 60 of file class.ilDateTime.php.
|
protected |
Definition at line 63 of file class.ilDateTime.php.
Referenced by getUnixTime(), increment(), and setDate().
const ilDateTime::DAY = 'day' |
Definition at line 55 of file class.ilDateTime.php.
Referenced by ilCalendarRecurrenceCalculator\applyBYMONTHDAYRules(), ilCalendarRecurrenceCalculator\applyBYYEARDAYRules(), ilCalendarSchedule\getByDay(), ilCalendarHeaderNavigationGUI\getHTML(), ilCalendarRecurrenceCalculator\incrementByFrequency(), and ilCalendarDayGUI\show().
const ilDateTime::HOUR = 'hour' |
Definition at line 56 of file class.ilDateTime.php.
const ilDateTime::MONTH = 'month' |
Definition at line 53 of file class.ilDateTime.php.
Referenced by ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilCalendarRecurrenceCalculator\applyBYMONTHRules(), ilCalendarHeaderNavigationGUI\getHTML(), ilCalendarRecurrenceCalculator\incrementByFrequency(), and ilCalendarMonthGUI\show().
const ilDateTime::WEEK = 'week' |
Definition at line 54 of file class.ilDateTime.php.
Referenced by ilCalendarRecurrenceCalculator\applyBYWEEKNORules(), ilCalendarHeaderNavigationGUI\getHTML(), ilCalendarRecurrenceCalculator\incrementByFrequency(), and ilCalendarWeekGUI\show().
const ilDateTime::YEAR = 'year' |
Definition at line 52 of file class.ilDateTime.php.
Referenced by ilCalendarRecurrenceCalculator\incrementByFrequency().