Lines Matching full:date

12  * This class is responsible for parsing the several different date and time
48 …$date = new DateTimeImmutable($matches[1].'-'.$matches[2].'-'.$matches[3].' '.$matches[4].':'.$mat…
53 return $date;
57 * Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
59 * @param string $date
64 public static function parseDate($date, DateTimeZone $tz = null) argument
67 $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches);
70 … throw new InvalidDataException('The supplied iCalendar date value is incorrect: '.$date);
78 $date = new DateTimeImmutable($matches[1].'-'.$matches[2].'-'.$matches[3], $tz);
80 … throw new InvalidDataException('The supplied iCalendar date value is incorrect: '.$date);
83 return $date;
191 * Parses either a Date or DateTime, or Duration value.
193 * @param string $date
198 public static function parse($date, $referenceTz = null) argument
200 if ('P' === $date[0] || ('-' === $date[0] && 'P' === $date[1])) {
201 return self::parseDuration($date);
202 } elseif (8 === strlen($date)) {
203 return self::parseDate($date, $referenceTz);
205 return self::parseDateTime($date, $referenceTz);
210 * This method parses a vCard date and or time value.
212 * This can be used for the DATE, DATE-TIME, TIMESTAMP and
213 * DATE-AND-OR-TIME value.
218 * year, month, date, hour, minute, second, timezone
227 * List of date formats that are supported:
252 * A full basic-format date-time string looks like :
255 * A full extended-format date-time string looks like :
261 * @param string $date
265 public static function parseVCardDateTime($date) argument
268 (?: # date part
273 (?<date> [0-9]{2})?
290 if (!preg_match($regex, $date, $matches)) {
293 (?: # date part
296 (?<date> [0-9]{2})
314 if (!preg_match($regex, $date, $matches)) {
315 throw new InvalidDataException('Invalid vCard date-time string: '.$date);
321 'date',
380 * @param string $date
384 public static function parseVCardTime($date) argument
399 if (!preg_match($regex, $date, $matches)) {
414 if (!preg_match($regex, $date, $matches)) {
415 throw new InvalidDataException('Invalid vCard time string: '.$date);
440 * This method parses a vCard date and or time value.
442 * This can be used for the DATE, DATE-TIME and
443 * DATE-AND-OR-TIME value.
447 * year, month, date, hour, minute, second, timezone
455 * List of date formats that are supported:
472 * List of supported date-time formats:
486 * @param string $date
490 public static function parseVCardDateAndOrTime($date) argument
494 '(?<year>\d{4})(?<month>\d\d)(?<date>\d\d)'.
496 '|--(?<month>\d\d)(?<date>\d\d)?'.
497 '|---(?<date>\d\d)'.
518 // date-and-or-time is date | date-time | time
521 if (0 === preg_match($valueDate, $date, $matches)
522 && 0 === preg_match($valueDateTime, $date, $matches)
523 && 0 === preg_match($valueTime, $date, $matches)) {
524 throw new InvalidDataException('Invalid vCard date-time string: '.$date);
530 'date' => null,
538 $parts['date0'] = &$parts['date'];
539 $parts['date1'] = &$parts['date'];
540 $parts['date2'] = &$parts['date'];