Closed teo2600 closed 1 year ago
// Make sure a default timezone is set
date_default_timezone_set("Europe/Rome");
$ical = new ICal($filename); foreach ($ical->events() as $event) { // Get the unix timestamp of the event start $timestamp = $event->dtstart_array[2];
// Print out a formatted date and time
echo date("Y-m-d H:i:s", $timestamp) . "\n";
}
----
2. You can use `print_r()` to print out each `ICal\Event` object and find out the publically available members:
```php
$ical = new ICal($filename);
foreach ($ical->events() as $event) {
echo print_r($event, true);
}
Then pick which member you wish to extract:
$ical = new ICal($filename);
foreach ($ical->events() as $event) {
echo $event->dtend . "\n";
}
@teo2600: has the above solved your issue?
I solved this issue using a workaround: reading DTSTART_TZ and DTEND_TZ instead... Thanks.
I solved this issue using a workaround: reading DTSTART_TZ and DTEND_TZ instead... Thanks.
Did that work for you? For me, dtstart
and dstart_tz
return the same values, so I have to read from dtstart_array
to get the correct timezone.
PHP Version
8.2
PHP date.timezone
Europe/Rome
ICS Parser Version
3.2.1
Operating System
Linux
Description
Considering the "examples", I would like:
1) To display the time in the correct Timezone (Europe/Rome), but even setting that it keeps displaying the UTC time: how could I solve this?
2) To display not only the summary and start time of the event, but also the end time and the description: how?
Thank you very much!
Steps to Reproduce
BEGIN:VCALENDAR PRODID:-//Google Inc//Google Calendar 70.9054//EN VERSION:2.0 CALSCALE:GREGORIAN METHOD:PUBLISH X-WR-CALNAME:PhD38it X-WR-TIMEZONE:Europe/Rome BEGIN:VEVENT DTSTART:20230509T070000Z DTEND:20230509T080000Z DTSTAMP:20230503T194722Z UID:XXX@google.com CREATED:20230503T144541Z DESCRIPTION: LAST-MODIFIED:20230503T150822Z LOCATION: SEQUENCE:2 STATUS:CONFIRMED SUMMARY:Prova TRANSP:OPAQUE END:VEVENT END:VCALENDAR