From: sol beach [mailto:[EMAIL PROTECTED] 

> In Oracle TRUNC(data_time_var) returns only the date portion of a
> date_time data type.
> What's the easiest way in MYSQL to accomplish the same thing?
> I tried to RTFM  (Paul DuBios' MYSQL tome; 2nd Ed.), but no clean
> solution lept out at me.
> It is a GREAT book, but it did not help me in this case.
> 
> TIA!

Try this:

SELECT DATE_FORMAT(date_time_var, '%Y-%m-%d')

You can customize what fields you'd like in the second arg. Above will
return YYYY-MM-DD.

More here:
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Also, as of 4.1.1, you can use DATE(date_time_var) to return the date
portion.

HTH!


-- 
Mike Johnson             Smarter Living, Inc.
Web Developer            www.smarterliving.com
[EMAIL PROTECTED]   (617) 886-5539


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to