PHP 클래스 Horde_Date, horde

파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_corrections array Map of required correction masks.
$_defaultFormat string Default format for __toString()
$_defaultSpecs string Default specs that are always supported.
$_formatCache
$_hour integer Hour
$_mday integer Day
$_min integer Minute
$_month integer Month
$_sec integer Second
$_supportedSpecs string Internally supported strftime() specifiers.
$_timezone string String representation of the date's timezone.
$_timezoneAbbreviations array These aliases map timezone abbreviations to those understood by PHP.
$_timezoneAliases array These aliases map Windows, Lotus, and other Timezone IDs to those understood by PHP.
$_timezoneIdentifiers array A list of (Olson) timezone identifiers understood by PHP.
$_year integer Year

공개 메소드들

메소드 설명
__construct ( $date = null, $timezone = null ) Builds a new date object. If $date contains date parts, use them to initialize the object.
__get ( string $name ) : integer | string Getter for the date and time properties.
__isset ( string $name ) : boolen Returns whether a date or time property exists.
__set ( string $name, integer | string $value ) Setter for the date and time properties.
__toString ( ) : string Returns a simple string representation of the date object
add ( $factor ) Adds a number of seconds or units to this date, returning a new Date object.
after ( mixed $other ) : boolean Returns whether this date is after the other.
before ( mixed $other ) : boolean Returns whether this date is before the other.
compareDate ( mixed $other ) : integer Compares this date to another date object to see which one is greater (later). Assumes that the dates are in the same timezone.
compareDateTime ( mixed $other ) : integer Compares this to another date object, including times, to see which one is greater (later). Assumes that the dates are in the same timezone.
compareTime ( mixed $other ) : integer Compares this to another date object by time, to see which one is greater (later). Assumes that the dates are in the same timezone.
dateString ( ) : string Formats date and time to be passed around as a short url parameter.
datestamp ( ) : integer Returns the unix timestamp representation of this date, 12:00am.
dayOfWeek ( ) : integer Returns the day of the week (0 = Sunday, 6 = Saturday) of this date.
dayOfYear ( ) : integer Returns the day number of the year (1 to 365/366).
diff ( Horde_Date $other ) : integer Returns number of days between this date and another.
equals ( mixed $other ) : boolean Returns whether this date is the same like the other.
format ( string $format ) : string Formats time using the specifiers available in date() or in the DateTime class' format() method.
fromDays ( integer $days ) : Horde_Date Converts number of days since 24th November, 4714 B.C. (in the proleptic Gregorian calendar, which is year -4713 using 'Astronomical' year numbering) to Gregorian calendar date.
getTimezoneAlias ( string $timezone ) : string Returns the normalized (Olson) timezone name of a timezone alias.
isValid ( ) : boolean Is the date currently represented by this object a valid date?
setDefaultFormat ( string $format ) Sets the default date format used in __toString()
setNthWeekday ( integer $weekday, integer $nth = 1 ) Sets the date of this object to the $nth weekday of $weekday.
setTimezone ( string $timezone ) : Horde_Date Converts this object to a different timezone.
strftime ( $format ) : string Formats date and time using strftime() format.
sub ( $factor ) Subtracts a number of seconds or units from this date, returning a new Horde_Date object.
timestamp ( ) : integer Returns the unix timestamp representation of this date.
toDateTime ( ) : DateTime Returns a DateTime object representing this object.
toDays ( ) : integer Converts a date in the proleptic Gregorian calendar to the no of days since 24th November, 4714 B.C.
toJson ( ) : string Formats date and time to the ISO format used by JSON.
toiCalendar ( boolean $floating = false ) : string Formats date and time to the RFC 2445 iCalendar DATE-TIME format.
tzOffset ( boolean $colon = true ) : string Returns the time offset for local time zone.
weekOfMonth ( ) : integer Returns the week of the month.
weekOfYear ( ) : integer Returns the week of the year, first Monday is first day of first week.
weeksInYear ( integer $year ) : integer Returns the number of weeks in the given year (52 or 53).

보호된 메소드들

메소드 설명
_correct ( integer $mask = self::MASK_ALLPARTS, integer $down = false ) Corrects any over- or underflows in any of the date's members.
_correctMonth ( ) Corrects the current month.
_initializeFromArgs ( $args ) Handles args in order: year month day hour min sec tz
_initializeFromArray ( $date )
_initializeFromObject ( $date )
_initializeTimezone ( $timezone )
_regexCallback ( $reg ) : string Callback used to replace a strtime pattern
_strftime ( $format ) : string Formats date and time using a limited set of the strftime() format.

메소드 상세

__construct() 공개 메소드

Recognized formats: - arrays with keys 'year', 'month', 'mday', 'day' 'hour', 'min', 'minute', 'sec' - objects with properties 'year', 'month', 'mday', 'hour', 'min', 'sec' - yyyy-mm-dd hh:mm:ss - yyyymmddhhmmss - yyyymmddThhmmssZ - yyyymmdd (might conflict with unix timestamps between 31 Oct 1966 and 03 Mar 1973) - unix timestamps - anything parsed by strtotime()/DateTime.
public __construct ( $date = null, $timezone = null )

__get() 공개 메소드

Getter for the date and time properties.
public __get ( string $name ) : integer | string
$name string One of 'year', 'month', 'mday', 'hour', 'min', 'sec' or 'timezone' (since Horde_Date 2.0.0).
리턴 integer | string The property value, or null if not set.

__isset() 공개 메소드

Returns whether a date or time property exists.
public __isset ( string $name ) : boolen
$name string One of 'year', 'month', 'mday', 'hour', 'min' or 'sec'.
리턴 boolen True if the property exists and is set.

__set() 공개 메소드

Setter for the date and time properties.
public __set ( string $name, integer | string $value )
$name string One of 'year', 'month', 'mday', 'hour', 'min', 'sec' or 'timezone' (since Horde_Date 2.0.0).
$value integer | string The property value.

__toString() 공개 메소드

Returns a simple string representation of the date object
public __toString ( ) : string
리턴 string This object converted to a string.

_correct() 보호된 메소드

Corrects any over- or underflows in any of the date's members.
protected _correct ( integer $mask = self::MASK_ALLPARTS, integer $down = false )
$mask integer We may not want to correct some overflows.
$down integer Whether to correct the date up or down.

_correctMonth() 보호된 메소드

This cannot be done in _correct() because that would also trigger a correction of the day, which would result in an infinite loop.
protected _correctMonth ( )

_initializeFromArgs() 보호된 메소드

Handles args in order: year month day hour min sec tz
protected _initializeFromArgs ( $args )

_initializeFromArray() 보호된 메소드

protected _initializeFromArray ( $date )

_initializeFromObject() 보호된 메소드

protected _initializeFromObject ( $date )

_initializeTimezone() 보호된 메소드

protected _initializeTimezone ( $timezone )

_regexCallback() 보호된 메소드

Callback used to replace a strtime pattern
protected _regexCallback ( $reg ) : string
리턴 string Replacement string.

_strftime() 보호된 메소드

Formats date and time using a limited set of the strftime() format.
protected _strftime ( $format ) : string
리턴 string strftime() formatted date and time.

add() 공개 메소드

Adds a number of seconds or units to this date, returning a new Date object.
public add ( $factor )

after() 공개 메소드

Returns whether this date is after the other.
public after ( mixed $other ) : boolean
$other mixed The date to compare to.
리턴 boolean True if this date is after the other.

before() 공개 메소드

Returns whether this date is before the other.
public before ( mixed $other ) : boolean
$other mixed The date to compare to.
리턴 boolean True if this date is before the other.

compareDate() 공개 메소드

Compares this date to another date object to see which one is greater (later). Assumes that the dates are in the same timezone.
public compareDate ( mixed $other ) : integer
$other mixed The date to compare to.
리턴 integer == 0 if they are on the same date >= 1 if $this is greater (later) <= -1 if $other is greater (later)

compareDateTime() 공개 메소드

Compares this to another date object, including times, to see which one is greater (later). Assumes that the dates are in the same timezone.
public compareDateTime ( mixed $other ) : integer
$other mixed The date to compare to.
리턴 integer == 0 if they are equal >= 1 if $this is greater (later) <= -1 if $other is greater (later)

compareTime() 공개 메소드

Compares this to another date object by time, to see which one is greater (later). Assumes that the dates are in the same timezone.
public compareTime ( mixed $other ) : integer
$other mixed The date to compare to.
리턴 integer == 0 if they are at the same time >= 1 if $this is greater (later) <= -1 if $other is greater (later)

dateString() 공개 메소드

Formats date and time to be passed around as a short url parameter.
public dateString ( ) : string
리턴 string Date and time.

datestamp() 공개 메소드

Returns the unix timestamp representation of this date, 12:00am.
public datestamp ( ) : integer
리턴 integer A unix timestamp.

dayOfWeek() 공개 메소드

Returns the day of the week (0 = Sunday, 6 = Saturday) of this date.
public dayOfWeek ( ) : integer
리턴 integer The day of the week.

dayOfYear() 공개 메소드

Returns the day number of the year (1 to 365/366).
public dayOfYear ( ) : integer
리턴 integer The day of the year.

diff() 공개 메소드

Returns number of days between this date and another.
public diff ( Horde_Date $other ) : integer
$other Horde_Date The other day to diff with.
리턴 integer The absolute number of days between the two dates.

equals() 공개 메소드

Returns whether this date is the same like the other.
public equals ( mixed $other ) : boolean
$other mixed The date to compare to.
리턴 boolean True if this date is the same like the other.

format() 공개 메소드

To format in languages other than English, use strftime() instead.
public format ( string $format ) : string
$format string
리턴 string Formatted time.

fromDays() 공개 정적인 메소드

Returned date belongs to the proleptic Gregorian calendar, using 'Astronomical' year numbering. The algorithm is valid for all years (positive and negative), and also for years preceding 4714 B.C. (i.e. for negative 'Julian Days'), and so the only limitation is platform-dependent (for 32-bit systems the maximum year would be something like about 1,465,190 A.D.). N.B. Monday, 24th November, 4714 B.C. is Julian Day '0'. Algorithm is from PEAR::Date_Calc
저자: Monte Ohrt ([email protected])
저자: Pierre-Alain Joye ([email protected])
저자: Daniel Convissor ([email protected])
저자: C.A. Woodcock ([email protected])
public static fromDays ( integer $days ) : Horde_Date
$days integer the number of days since 24th November, 4714 B.C.
리턴 Horde_Date A Horde_Date object representing the date.

getTimezoneAlias() 공개 정적인 메소드

We currently support Windows and Lotus timezone names, and timezone abbreviations.
public static getTimezoneAlias ( string $timezone ) : string
$timezone string Some timezone alias.
리턴 string The Olson timezone name, or the original value, if no alias found.

isValid() 공개 메소드

Is the date currently represented by this object a valid date?
public isValid ( ) : boolean
리턴 boolean Validity, counting leap years, etc.

setDefaultFormat() 공개 메소드

Sets the default date format used in __toString()
public setDefaultFormat ( string $format )
$format string

setNthWeekday() 공개 메소드

Sets the date of this object to the $nth weekday of $weekday.
public setNthWeekday ( integer $weekday, integer $nth = 1 )
$weekday integer The day of the week (0 = Sunday, etc).
$nth integer The $nth $weekday to set to (defaults to 1). Negative values count from end of the month (@since Horde_Date 2.1.0).

setTimezone() 공개 메소드

Converts this object to a different timezone.
public setTimezone ( string $timezone ) : Horde_Date
$timezone string The new timezone.
리턴 Horde_Date This object.

strftime() 공개 메소드

Formats date and time using strftime() format.
public strftime ( $format ) : string
리턴 string strftime() formatted date and time.

sub() 공개 메소드

Subtracts a number of seconds or units from this date, returning a new Horde_Date object.
public sub ( $factor )

timestamp() 공개 메소드

Returns the unix timestamp representation of this date.
public timestamp ( ) : integer
리턴 integer A unix timestamp.

toDateTime() 공개 메소드

Returns a DateTime object representing this object.
public toDateTime ( ) : DateTime
리턴 DateTime

toDays() 공개 메소드

Returns the no of days since Monday, 24th November, 4714 B.C. in the proleptic Gregorian calendar (which is 24th November, -4713 using 'Astronomical' year numbering, and 1st January, 4713 B.C. in the proleptic Julian calendar). This is also the first day of the 'Julian Period' proposed by Joseph Scaliger in 1583, and the number of days since this date is known as the 'Julian Day'. (It is not directly to do with the Julian calendar, although this is where the name is derived from.) The algorithm is valid for all years (positive and negative), and also for years preceding 4714 B.C. Algorithm is from PEAR::Date_Calc
저자: Monte Ohrt ([email protected])
저자: Pierre-Alain Joye ([email protected])
저자: Daniel Convissor ([email protected])
저자: C.A. Woodcock ([email protected])
public toDays ( ) : integer
리턴 integer The number of days since 24th November, 4714 B.C.

toJson() 공개 메소드

Formats date and time to the ISO format used by JSON.
public toJson ( ) : string
리턴 string Date and time.

toiCalendar() 공개 메소드

Formats date and time to the RFC 2445 iCalendar DATE-TIME format.
public toiCalendar ( boolean $floating = false ) : string
$floating boolean Whether to return a floating date-time (without time zone information).
리턴 string Date and time.

tzOffset() 공개 메소드

Returns the time offset for local time zone.
public tzOffset ( boolean $colon = true ) : string
$colon boolean Place a colon between hours and minutes?
리턴 string Timezone offset as a string in the format +HH:MM.

weekOfMonth() 공개 메소드

Returns the week of the month.
public weekOfMonth ( ) : integer
리턴 integer The week number.

weekOfYear() 공개 메소드

Returns the week of the year, first Monday is first day of first week.
public weekOfYear ( ) : integer
리턴 integer The week number.

weeksInYear() 공개 정적인 메소드

Returns the number of weeks in the given year (52 or 53).
public static weeksInYear ( integer $year ) : integer
$year integer The year to count the number of weeks in.
리턴 integer $numWeeks The number of weeks in $year.

프로퍼티 상세

$_corrections 보호되어 있는 정적으로 프로퍼티

Map of required correction masks.
또한 보기: __set()
protected static array $_corrections
리턴 array

$_defaultFormat 보호되어 있는 프로퍼티

Default format for __toString()
protected string $_defaultFormat
리턴 string

$_defaultSpecs 보호되어 있는 정적으로 프로퍼티

Default specs that are always supported.
protected static string $_defaultSpecs
리턴 string

$_formatCache 보호되어 있는 프로퍼티

protected $_formatCache

$_hour 보호되어 있는 프로퍼티

Hour
protected int $_hour
리턴 integer

$_mday 보호되어 있는 프로퍼티

Day
protected int $_mday
리턴 integer

$_min 보호되어 있는 프로퍼티

Minute
protected int $_min
리턴 integer

$_month 보호되어 있는 프로퍼티

Month
protected int $_month
리턴 integer

$_sec 보호되어 있는 프로퍼티

Second
protected int $_sec
리턴 integer

$_supportedSpecs 보호되어 있는 정적으로 프로퍼티

Internally supported strftime() specifiers.
protected static string $_supportedSpecs
리턴 string

$_timezone 보호되어 있는 프로퍼티

String representation of the date's timezone.
protected string $_timezone
리턴 string

$_timezoneAbbreviations 보호되어 있는 정적으로 프로퍼티

These aliases map timezone abbreviations to those understood by PHP.
또한 보기: getTimezoneAlias()
protected static array $_timezoneAbbreviations
리턴 array

$_timezoneAliases 보호되어 있는 정적으로 프로퍼티

These aliases map Windows, Lotus, and other Timezone IDs to those understood by PHP.
protected static array $_timezoneAliases
리턴 array

$_timezoneIdentifiers 보호되어 있는 정적으로 프로퍼티

A list of (Olson) timezone identifiers understood by PHP.
또한 보기: getTimezoneAlias()
protected static array $_timezoneIdentifiers
리턴 array

$_year 보호되어 있는 프로퍼티

Year
protected int $_year
리턴 integer