我的。ics-file在Google Cal中没有显示正确的时区。在iCal和iPhone &iPad上显示的。我真看不出有什么不对!
时区必须设置为Copenhagen-time:)
<?php
date_default_timezone_set('Europe/Copenhagen');
include("includes/db_connect.php");
$schedules = "BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:HG Kalender";
$schedules .= "-//Drupal iCal API//EN";
$result=mysql_query("SELECT * FROM `x`");
while($rows=mysql_fetch_array($result)){
$overskrift = $rows['overskrift'];
$date = $rows['date'];
$month = $rows['month'];
$year = $rows['year'];
$start_hour = $rows['start_hour'];
$start_minute = $rows['start_minute'];
$end_hour = $rows['end_hour'];
$end_minute = $rows['end_minute'];
$end_place = $rows['end_place'];
$start_place = $rows['start_place'];
$info = $rows['info'];
$idets = $rows['id'];
$ics_dato = $year.$month.$date;
$start_hour = $start_hour;
$end_hour = $end_hour;
$ics_starttidspunkt = $start_hour.$start_minute."00";
$ics_sluttidspunkt = $end_hour.$end_minute."00";
$schedules .= "nBEGIN:VEVENT";
$schedules .= "nUID:" . time().rand(11111, 99999);
$schedules .= "nDTSTAMP:" . date("Y-m-d H:i:s");
$schedules .= "nDTSTART:" . date("$ics_dato", $strDate)."T".date("$ics_starttidspunkt");
$schedules .= "nLOCATION:".$start_place;
$schedules .= "nDTEND:". date("$ics_dato",$endDate)."T".date("$ics_sluttidspunkt");
$schedules .= "nSUMMARY:".$overskrift;
$schedules .= "nURL:x.com;
$schedules .= "nDESCRIPTION:text;
$schedules .= "nEND:VEVENT";
}
$schedules .= "nEND:VCALENDAR";
header( "Content-type: text/calendar");
header("Expires: 0");
file_put_contents("x.ics",$schedules);
?>
输出(.ics-file):
BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:HG Kalender-//Drupal iCal API//EN
BEGIN:VEVENT
UID:136869502441928
DTSTAMP:2013-05-16 11:03:44
DTSTART:20130622T100000
LOCATION:Holbæk Stadion
DTEND:20130622T160000
SUMMARY:Tattootræning
URL:x.com
DESCRIPTION:text
END:VEVENT
END:VCALENDAR
谢谢!:)
您没有指定任何时区。
这意味着你正在使用'浮动时间',这将导致日历客户端只是'猜测'正确的时区。
您应该指定UTC时间(要做到这一点,以Z
结束时间)或使用TZID
属性指定时区。
正式地,你还必须包括VTIMEZONE
块为每一个TZID
你使用,但只要你使用Olson时区Id,客户端往往工作没有问题。