Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date () with a full month 2

Status
Not open for further replies.

kupe

Technical User
Sep 23, 2002
376
Date function - date("m-D-Y", strtotime($myrow['NewsDate'])) - gives me an abbreviated month. How can I get a full month (March instead of Mar), please, gurus?
 
Sorry, looked at my book and couldn't find it. Thanks for the direction. Cheers.
 
Vragabond
I'm much more familiar with sql dates, but I thought it had to be php, which I now know, thanks to Ken, is F.

Be interested to see how you would write that line in mysql, Vragabond. Cheers
 
Well, without seeing the SQL sentence (but assuming that you are using MySQL), if the only thing you want pulling out of the database is the date, it would look somewhat like this:
Code:
SELECT DATE_FORMAT(NewsDate, '%M-%e-%Y') as NewsDateFormatted FROM table;
Then just echo that:
Code:
echo $myrow['NewsDateFormatted'];
Of course you could select any of the formatting options from the table on the page.
 
Thanks very much, Vragabond.

The part that refers to the date -

date("m-D-Y", strtotime($myrow['NewsDate']))

- didn't want to respond to the mysql DATE_FORMAT() function, so I presumed it would accept only a php instruction.

(I'm new, of course, and while I understand much of mysql, I'm very slow in coming to terms with php. But, yes, it is a mysql/php thing for the net. I find it very exciting - and amazing how everything can live in a database. I was doing a little with asp, but this is so much better, and much more, well, fun.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top