如何在 ICS 中先显示时间再显示日期

how to display time first followed by date in ICS

我正在为我的应用程序使用 ICS 文件,它显示正确的日期和时间(e.g.Sat 2014 年 11 月 7 日 11:50am (IST)),但我想先显示时间再显示日期(例如11:50am 2014 年 11 月 7 日(IST))怎么做?

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 文件的应用程序以他们选择的任何格式显示日期。