I have records with no time attached so, with the rss feed I'm just getting 00:00.
I need help customizing this code to remove the time but, keep the date.
Any help would be great as I have been playing with this for fat too long :)
$get_courses = "SELECT
courses.course_id,
DATE_FORMAT(courses.date_added,'%a %b %e %Y') as formatted_date_added,
courses.course_type,
courses.start_date,
location_name,
price,
duration
FROM courses
JOIN addresses ON courses.course_get_address_id = addresses.address_id
WHERE courses.active = 'Active'
ORDER BY courses.date_added DESC
LIMIT 30";
XML
'<pubDate>'.$course['formatted_date_added'].' GMT</pubDate>'
Change
DATE_FORMAT(courses.date_added,'%a %b %e %Y') as formatted_date_added
to
UNIX_TIMESTAMP(courses.date_added) as formatted_date_added
and in PHP:
if (date("H:i", $tuple["when"]) == "00:00")
// without time
echo '<pubDate>'.strftime('%a %b %e %Y',
$course['formatted_date_added']).' GMT</pubDate>';
else
// with time
echo '<pubDate>'.strftime('%a %b %e %Y %r',
$course['formatted_date_added']).' GMT</pubDate>';
Or just output
'<pubDate>'.strftime('%a %b %e %Y', $course['formatted_date_added']).' GMT</pubDate>'
if you won't ever have time information.