Afficher un message
Vieux 01/10/2007, 16h39   #4
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Timestamp conversion problem

On 1 Oct, 16:35, Rey <reycoll...@cox.net> wrote:
> On Sep 28, 4:55 pm, gordonb.5j...@burditt.org (Gordon Burditt) wrote:
>
>
>
>
>
> > >Am somewhat new to mySQL 5...in conjunction with phpTimeClock (open
> > >source app) on a winXP sp2 box.

>
> > >Trying to convert a column named timestamp (bingint(14)) so that it
> > >displays the date in year month day using date_format(timestamp, '%Y%m
> > >%e') with statement:

>
> > >select date_format('timestamp', '%Y%m%e'),note from info where
> > >fullname like 'martina%';

>
> > 'timestamp' is a fixed string containing 9 alphabetic characters.
> > `timestamp` is a column name.
> > timestamp is a keyword and it can't be used as a column name unless you
> > backquote (``) it.

>
> > >And I get:
> > >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 'inout as test, `inout` from info' at line 1

>
> > I see absolutely nothing in the above query that says "inout as test".

>
> > >An example of the data in the timestamp column is 1172008033.
> > >In addition, when attempting to add the column inout (varchar (50)) as
> > >in
> > >select notes, inout from info;

>
> > >I get the same err whose err number is 1064.

>
> > >Appreciate if someone could direct me to the correct syntax...

>
> Howdy Gordon.
> Thanks for replying and info on timestamp column.
>
> I also backquoted the inout column as I had forgotten to mention that
> both the mySQL query browser and HeidiSQL where showing inout in same
> syntax colors as select...
>
> So now with this statement I get the timestamp values (1184100363) and
> the inout values (out, in, in for lunch):
> select `timestamp`,date_format(`timestamp`, '%c%d%Y') as theDate,
> `inout` from info where fullname like 'martina%';
>
> However, in date_format conversion returns null for all values in that
> column. As the 'timestamp' column is a BigInt then will have to figue
> out how to convert this to a date, etc. Now to check back at
> SorgeForge site for info, in any, on it conversion.
>
> Thanks,
> Rey- Hide quoted text -
>
> - Show quoted text -


Why not make your timesamp column a timestamp type?

  Réponse avec citation
 
Page generated in 0,07451 seconds with 9 queries