-1

I'm trying to have my PHP file output a text/calendar file, but

the funny thing is , both of these 2 outputs don't work.

BEGIN:VCALENDAR VERSION:2.0 PRODID:-//aln/qc//NONSGML v1.0//EN CALSCALE:GREGORIAN BEGIN:VEVENT DTSTART;TZID="Asia/Singapore":20160817T93000 DTEND;TZID="Asia/Singapore":20160817T94500 UID: DTSTAMP:20160817T31133Z DESCRIPTION: SUMMARY:test event END:VEVENT END:VCALENDAR

BEGIN:VCALENDAR VERSION:2.0 PRODID:-//aln/qc//NONSGML v1.0//EN CALSCALE:GREGORIAN BEGIN:VEVENT DTSTART;TZID="Asia/Singapore":20160817T93000 DTEND;TZID="Asia/Singapore":20160817T94500 UID: DTSTAMP:20160817T31643Z DESCRIPTION: SUMMARY:test event END:VEVENT END:VCALENDAR

but this does

BEGIN:VCALENDAR VERSION:2.0 PRODID:-//aln/qc//NONSGML v1.0//EN CALSCALE:GREGORIAN BEGIN:VEVENT DTSTART;TZID="Asia/Singapore":20160817T183000 DTEND;TZID="Asia/Singapore":20160817T184500 UID: DTSTAMP:20160817T31722Z DESCRIPTION: SUMMARY:test event END:VEVENT END:VCALENDAR

anyone has any idea why?

I used date('Ymd\TGis', strtotime($datetime)) to for the date time, resulting in the omission of a "0" after "T"

Andreas
  • 23,610
  • 6
  • 30
  • 62
Ong Pe Hon
  • 305
  • 3
  • 11

2 Answers2

0

Since OP has shown that my comment is correct by writing it out as an answer I will post it too.
You other choose who "called it".

The DateTime is in the format YYYYMMDDTHHMMSS.
Meaning it needs two digits hour not one.

Andreas
  • 23,610
  • 6
  • 30
  • 62
-1

The problem was with 20160817T93000

I used date('Ymd\TGis', strtotime($datetime)) to for the date time, resulting in the omission of a "0" after "T"

the correct date time should be 20160817T093000, using the date('Ymd\THis', strtotime($datetime))

Ong Pe Hon
  • 305
  • 3
  • 11