0
我的.ics文件沒有在Google Cal中顯示正確的時區。在iCal和iPhone上使用iPad &正確顯示。我真的看不到有什麼問題!
的時區已被設置哥本哈根時間:)
帶有錯誤時區的Ics文件
<?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文件):
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
謝謝! :)
我不明白你在哪裏,包括任何時區信息。請顯示此生成的示例ics文件的完整輸出。謝謝。 –
我已將它添加到descreption! :) –