Reputation: 690
I'm trying to format my stored dates 2013-04-23 19:00
to iCal format: 20130423T190000
.
Here's how I'm trying to do it:
$start = strtotime($event["event_start"]);
$start = date('Ymd\THis',$start);
This code returns 19691231T190000
.
I thought that because the starting string is missing seconds, that could have been the problem, but after trying $start = strtotime($event["event_start"] . ":00");
I've ruled that out.
Upvotes: 1
Views: 551
Reputation: 1642
cYou appear to be missing something. Are you sure $event["event_start"] is populated.
date('Ymd\THis',strtotime('2013-04-23 19:00')) == 20130423T190000
While
date('Ymd\THis',strtotime('')) == 19691231T190000
Check value of $event["event_start"].
EDIT: Hint was that 1969 is suspiciously close to UNIX epoch of 1970.
FROM marc b -> the difference was the timezone of UTC +5
Upvotes: 1
Reputation: 2361
Try this:
$str = "DTSTART;TZID=<your timezone>:".date('Ymd', strtotime($start));
See:
http://php.net/manual/en/timezones.php
Upvotes: 0