| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Subscribe to WebmasterWorld|
| 9:23 am on Apr 29, 2010 (gmt 0)|
SELECT NOW() + DAY(2) AS date, user_name FROM user_time
Why i get always "Null"?
| 1:34 pm on Apr 29, 2010 (gmt 0)|
The syntax for the DAY [dev.mysql.com] function is incorrect. That function requires a date expression. What are you trying to accomplish? Add two days to the current date?
| 5:15 pm on Apr 29, 2010 (gmt 0)|
Sounds like it . . . additionally remember that now() is a date and time result, curdate() is a date only result.
select date_add(curdate(),interval 2 day) as date, user_name from user_time
--> YYYY-MM-DD | rocknbil
select date_add(now(),interval 2 day) as date, user_name from user_time
--> YYYY-MM-DD HH:MM:SS | rocknbil
You can also wrap the date math functions in a date_format() command to extract a particular formatting output.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2014 all rights reserved