Is this wrong?
mysql> SELECT DATE_FORMAT ("20040601123456",'%Y-%m-%d');
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '("20040601123456",'%Y-%m-%d')' at line 1
Also I tried:
mysql> SELECT DATE_FORMAT (time,'%Y-%m-%d %H:%i')
-> from internet_usage
-> where time>20040601120000;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(time,'%Y-%m-%d %H:%i')
from internet_usage
where time=20040601
While in PHP you can try something like this...
$date_added = $row['date_added']; $date = date("M d, Y", strtotime($date_added)); echo $date;
H and i do work in PHP as well, I believe, if you want to add the hour and seconds. Check out the 'date' function in PHP for info.
- Eve
In MySQL you can do that with: DATE_FORMAT
DATE_FORMAT (column_name,'%Y-%m-%d %H:%i')
-----Mensaje original----- De: J S [mailto:[EMAIL PROTECTED] Enviado el: Miércoles, 14 de Julio de 2004 08:26 a.m. Para: [EMAIL PROTECTED] Asunto: sql function for timestamp
Hi,
What SQL function do I need to convert timestamp 200406011403 into "2004-06-01 14:03" ?
Thanks,
JS.
_________________________________________________________________ Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
_________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]