# booking-manager/2.1.7/assets/libs/icalendar/examples/timezoneevent.php

Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar, version 2.1.7. 48 lines.

- Page: https://pluginprobe.com/plugins/booking-manager/2.1.7/code/assets/libs/icalendar/examples/timezoneevent.php
- Raw: https://pluginprobe.com/plugins/booking-manager/2.1.7/raw/assets/libs/icalendar/examples/timezoneevent.php
- Modified: 2022-08-04T08:46:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booking-manager/2.1.7/code/assets/libs/icalendar/examples/timezoneevent.php#L10-L20`.

```php
<?php

/**
 * Create Event Example With Local Timezone
 *
 */

require_once("../zapcallib.php");

$title = "Event in New York timezone";
// date/time is in SQL datetime format
$event_start = "2020-01-01 12:00:00";
$event_end = "2020-01-01 13:00:00";
// timezone must be a supported PHP timezone
// (see http://php.net/manual/en/timezones.php )
// Note: multi-word timezones must use underscore "_" separator
$tzid = "America/New_York";

// create the ical object
$icalobj = new ZCiCal();

// Add timezone data
ZCTimeZoneHelper::getTZNode(substr($event_start,0,4),substr($event_end,0,4),$tzid, $icalobj->curnode);

// create the event within the ical object
$eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);

// add title
$eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $title));

// add start date
$eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($event_start)));

// add end date
$eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($event_end)));

// UID is a required item in VEVENT, create unique string for this event
// Adding your domain to the end is a good way of creating uniqueness
$uid = date('Y-m-d-H-i-s') . "@demo.icalendar.org";
$eventobj->addNode(new ZCiCalDataNode("UID:" . $uid));

// DTSTAMP is a required item in VEVENT
$eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));

// write iCalendar feed to stdout
echo $icalobj->export();


```
