![]() |
Date Format Question
I'm using the snippet of code Freddie posted here to get the date format:
Code:
SELECT DATE_FORMAT(eventdate,'%b-%d') AS eventdate Can I make it display as April-18 (ie, full month name)? |
Instead of %b use %M
|
Thanks neo :)
Now another question. I have this code: Code:
<?PHP |
|
There are two ways I know of doing it. Either add another row like "monthnum" and sort by that or, change the %M so that it reads in the date like 0-5-3 and then use MONTHNAME which would output May.
|
:ermm:
Where would I put MONTHNAME? |
Hmm well it would have to be in a different query maybe. BUt your best shot as far as I know would tp just enter the month number aswell for sorting purposes.
|
I worked it out - thanks for pointing me in the right direction :) I changed the code to:
SELECT eventid, DATE_FORMAT(eventdate,'%M %d') AS date, eventdate, ... And then just changed the later $event['eventdate'] to $event['date'] - so, it lists the month but sorts by the correct date :) Thanks Neo :D |
Now to try and find out how to make each row have an alternating background colour (like the posts in showthread) :)
|
Well have fun :)
I am off the the old sleep |
Thanks again :)
|
Hi,
I'm having a bit of trouble with formatting the date from the thread table. I am getting NULL as a result from this query: PHP Code:
|
Never mind...
FWIW, instead of using DATE_FORMAT, the correct option is to use FROM_UNIXTIME. :rambo: |
All times are GMT. The time now is 01:09 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|