Unix Technical Forum

date_format

This is a discussion on date_format within the MySQL forums, part of the Database Server Software category; --> I have just tried to use the date_format in my query and it doesn't return anything? Please can anyone ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-14-2008, 03:58 PM
CH
 
Posts: n/a
Default date_format

I have just tried to use the date_format in my query and it doesn't
return anything?
Please can anyone see any obvious errors?

$sql="SELECT DATE_FORMAT(post_date,'%W %b %Y'),post_title FROM mytable
WHERE MONTH(post_date) = 7 ORDER BY event_start";

post_date and post_tile are fields in the db.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-14-2008, 03:58 PM
CH
 
Posts: n/a
Default Re: date_format

I think I have found an answer to this!

I have added the "as col3" bit in here. This works now.

SELECT col1,col2,DATE_FORMAT(col3,'%a %d %M %Y') as col3 FROM mytable
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:10 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com