If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Showing month where expression is now()

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-13-05, 06:09
TheWock TheWock is offline
Registered User
 
Join Date: Nov 2005
Posts: 5
Showing month where expression is now()

Hi,

The answer to the question is probably very easy, still I can't find the answer. I've read the manual about date and time functions in MYSQL.

It shows a lot of examples like 'select month('1998-02-01')' which gives '02' as result.

What I want now is to select the month from the current date. In theory, the query should be something like 'select month('curdate()') but unfortunately, that doesn't work.

My question is, what should the query be?
Reply With Quote
  #2 (permalink)  
Old 12-13-05, 08:34
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
Use DATE_FORMAT:
Code:
SELECT DATE_FORMAT( NOW() , "%c" )
http://dev.mysql.com/doc/refman/5.0/...functions.html
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On