Jump to content

[SOLVED] date_format


bschultz

Recommended Posts

I have a calendar script that I downloaded, and I like it, but it sorts things out by the $starttime which is in this format

 

2007-08-26 15:00:00

 

The reason I want this fixed is that if you have an event that happens every Monday, it will "order by" the date...then the time.  So, an event for 3pm (that happens every Monday) will show up before an event at 9am for just that Monday.

 

I'm trying to adjust this code to strip out the date part of the variable

 

$query = 'SELECT * FROM '.SQL_PREFIX."events\n"
more code here
	."ORDER BY starttime";

 

Here's what I tried...

 

$stime = date_format(starttime, 'H:i:s');
$query = 'SELECT * FROM '.SQL_PREFIX."events\n"
more code here
	."ORDER BY sttime";

 

Here's the error I'm getting

 

Warning: date_format() expects parameter 1 to be DateTime, string given in calendar/includes/calendar.php on line 286

 

Any idea where I'm going wrong?

 

Thanks.

 

Brian

 

Link to comment
https://forums.phpfreaks.com/topic/100343-solved-date_format/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.