【发布时间】:2023-03-15 05:42:01
【问题描述】:
我有一个日期,我通过 jQuery 中的 formatDate 函数将其存储为时间戳。然后,我将检索此值以制作一个 ics 文件,一个将事件时间和详细信息添加到用户日历的日历文件。但是时间戳格式在 ics 文件中不起作用,没有添加正确的日期,因此我需要将其转换为类似于 20091109T101015Z 的值。它是当前格式,因为时间戳看起来像 1344466800000这是来自 this example,这是我创建 ics 文件所遵循的。
我的 php 文件链接是 http:// 域。 com/icsCreator.php?startDate=1344380400000&endDate=1345503600000&event=Space%20Weather%20Workshop&location=London
当前我的 ics 文件看起来像
<?php
$dtStart=$_GET['startDate'];
$dtEnd=$_GET['endDate'];
$eventName=$_GET['event'];
$location=$_GET['location'];
...
echo "CREATED:20091109T101015Z\n";
echo "DESCRIPTION:$eventName\n";
echo "DTEND:$dtEnd\n";
echo "DTSTART:".$dtStart."\n";
echo "LAST-MODIFIED:20091109T101015Z\n";
echo "LOCATION:$location\n";
...
?>
【问题讨论】:
-
你能删除所有不属于日期问题的行吗?