我正在为我的应用程序使用ICS文件,它显示正确的日期和时间(例如,2014年11月7日星期六上午11:50(IST)),但我想先显示时间,然后显示日期(例如,2013年11月17日上午11:50?
class ICS{
function __construct(){
}
function generateICS($timestamp_start, $timestamp_end, $subject, $address, $description, $event_url){
$datestr_start = $this->dateToCal($timestamp_start);
$datestr_end = $this->dateToCal($timestamp_end);
$datestr_current = $this->dateToCal(date('U'));
$esc_subject = $this->escapeString($subject);
$esc_address = $this->escapeString($address);
$esc_description = $this->escapeString($description);
$esc_url = $this->escapeString($event_url);
$uniqid = uniqid();
$ics = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTEND:$datestr_end
UID:$uniqid
DTSTAMP:$datestr_current
LOCATION:$address
DESCRIPTION:$esc_description
URL;VALUE=URI:$esc_url
SUMMARY:$esc_subject
DTSTART:$datestr_start
END:VEVENT
END:VCALENDAR
ICS;
return $ics;
}
function dateToCal($timestamp) {
return gmdate('Ymd'THis', $timestamp);
}
function escapeString($string) {
return preg_replace('/([',;])/',''''$1', $string);
}
}
?>
你看错地方了。ics文件中日期和时间的格式是固定的,并由iCalendar规范定义(请参阅https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5)。这取决于使用这些ics文件的应用程序以他们选择的任何格式显示日期。