-
Notifications
You must be signed in to change notification settings - Fork 129
Sabre VObject DateTimeParser
DateTimeParser
This class is responsible for parsing the several different date and time formats iCalendar and vCards have.
- Class name: DateTimeParser
- Namespace: Sabre\VObject
\Sabre\VObject\DateTime Sabre\VObject\DateTimeParser::parseDateTime(string $dt, \Sabre\VObject\DateTimeZone $tz)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTime object
Specifying a reference timezone is optional. It will only be used if the non-UTC format is used. The argument is used as a reference, the returned DateTime object will still be in the UTC timezone.
- Visibility: public
- This method is static.
- $dt string
- $tz Sabre\VObject\DateTimeZone
\Sabre\VObject\DateTime Sabre\VObject\DateTimeParser::parseDate(string $date)
Parses an iCalendar (rfc5545) formatted date and returns a DateTime object
- Visibility: public
- This method is static.
- $date string
\Sabre\VObject\DateInterval|string Sabre\VObject\DateTimeParser::parseDuration(string $duration, boolean $asString)
Parses an iCalendar (RFC5545) formatted duration value.
This method will either return a DateTimeInterval object, or a string suitable for strtotime or DateTime::modify.
- Visibility: public
- This method is static.
- $duration string
- $asString boolean
\Sabre\VObject\DateTime|\Sabre\VObject\DateInterval Sabre\VObject\DateTimeParser::parse(string $date, \Sabre\VObject\DateTimeZone|string $referenceTZ)
Parses either a Date or DateTime, or Duration value.
- Visibility: public
- This method is static.
- $date string
- $referenceTZ Sabre\VObject\DateTimeZone|string
array Sabre\VObject\DateTimeParser::parseVCardDateTime(string $date)
This method parses a vCard date and or time value.
This can be used for the DATE, DATE-TIME, TIMESTAMP and DATE-AND-OR-TIME value.
This method returns an array, not a DateTime value.
The elements in the array are in the following order: year, month, date, hour, minute, second, timezone
Almost any part of the string may be omitted. It's for example legal to just specify seconds, leave out the year, etc.
Timezone is either returned as 'Z' or as '+08:00'
For any non-specified values null is returned.
List of date formats that are supported: YYYY YYYY-MM YYYYMMDD --MMDD ---DD
YYYY-MM-DD --MM-DD ---DD
List of supported time formats:
HH HHMM HHMMSS -MMSS --SS
HH HH:MM HH:MM:SS -MM:SS --SS
A full basic-format date-time string looks like : 20130603T133901
A full extended-format date-time string looks like : 2013-06-03T13:39:01
Times may be postfixed by a timezone offset. This can be either 'Z' for UTC, or a string like -0500 or +1100.
- Visibility: public
- This method is static.
- $date string
array Sabre\VObject\DateTimeParser::parseVCardTime(string $date)
This method parses a vCard TIME value.
This method returns an array, not a DateTime value.
The elements in the array are in the following order: hour, minute, second, timezone
Almost any part of the string may be omitted. It's for example legal to just specify seconds, leave out the hour etc.
Timezone is either returned as 'Z' or as '+08:00'
For any non-specified values null is returned.
List of supported time formats:
HH HHMM HHMMSS -MMSS --SS
HH HH:MM HH:MM:SS -MM:SS --SS
A full basic-format time string looks like : 133901
A full extended-format time string looks like : 13:39:01
Times may be postfixed by a timezone offset. This can be either 'Z' for UTC, or a string like -0500 or +11:00.
- Visibility: public
- This method is static.
- $date string