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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.