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!

How do I get system date

Status
Not open for further replies.

hugonovo

MIS
Jul 21, 2003
53
PT
Hello all!!

I would like to know how do I get the system date on MySQL, with a single query?

Regrads,
Hugo Novo
 
okay, i just looked it up at mysql.com and you're right, the SELECT statement does not require a FROM clause

the reason i asked Hugo which query was because i'd hate to have to explain how to create an OOAK (one of a kind) table -- similar to oracle's DUAL -- if the current date was actually required along with something else in an existing query

but the FROM-less SELECT works fine

F.Y.I. mysql does not have a DATE() function, it supports the CURRENT_DATE function which is the international standard


rudy
 
what??!!

Hugo asked for date

now() gives date and time

CURRENT_DATE gives date


:)
 
sure, but hey, why include stuff that isn't asked for?

[tt]select CURRENT_DATE, MONTHNAME(CURRENT_DATE)[/tt]


rudy

 
perhaps
select date_format(current_date, '%e %m %Y')

where you can manage how your date looks like
;)
 
no

in microsoft access, you actually have to select from some table in your SELECT statement

rudy
SQL Consulting
 
hey guys, don't forget curdate() !

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top