List:General Discussion« Previous MessageNext Message »
From:J S Date:July 14 2004 4:20pm
Subject:RE: sql function for timestamp
View as plain text  
Thanks for your help. I would like to do it with the SQL. However I'm still 
having problems with the syntax below.

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:vervoom@stripped]
>Para: mysql@stripped
>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/mysql?unsub=1
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo

Thread
sql function for timestampJ S14 Jul
  • Re: sql function for timestampWesley Furgiuele14 Jul
RE: sql function for timestampGuillermo Chinchilla Zúñiga14 Jul
  • RE: sql function for timestampEve Atley14 Jul
RE: sql function for timestampJ S14 Jul
  • Re: sql function for timestampWesley Furgiuele14 Jul
Re: sql function for timestampJ S14 Jul