Horde_Date::toiCalendar PHP Method

toiCalendar() public method

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).
return string Date and time.
    public function toiCalendar($floating = false)
    {
        if ($floating) {
            return $this->format('Ymd\\THis');
        }
        $dateTime = $this->toDateTime();
        $dateTime->setTimezone(new DateTimeZone('UTC'));
        return $dateTime->format('Ymd\\THis\\Z');
    }

Usage Example

Ejemplo n.º 1
0
 public function testToiCalendar()
 {
     $test = new Horde_Date('20100101130000');
     $this->assertEquals('20100101T130000', $test->toiCalendar(true));
     $this->assertEquals('20100101T120000Z', $test->toiCalendar(false));
     $test = new Horde_Date('20100101130000', 'America/Argentina/Buenos_Aires');
     $this->assertEquals('20100101T130000', $test->toiCalendar(true));
     $this->assertEquals('20100101T160000Z', $test->toiCalendar(false));
 }