PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Timestamp conversion problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Timestamp conversion problem

Réponse
 
LinkBack Outils de la discussion
Vieux 29/09/2007, 00h03   #1
Rey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Timestamp conversion problem

Howdy.
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%';

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

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...

Thanks,

Rey

  Réponse avec citation
Vieux 29/09/2007, 00h55   #2
Gordon Burditt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Timestamp conversion problem

>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...

  Réponse avec citation
Vieux 01/10/2007, 16h35   #3
Rey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Timestamp conversion problem

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

  Réponse avec citation
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
Vieux 03/10/2007, 16h22   #5
Rey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Timestamp conversion problem

>
> Why not make your timesamp column a timestamp type?- Hide quoted text -
>


Howdy, Captain Paralytic.
Interesting name...

Added timestamp column as punchDate. Get errors when attempting to
cast `timestamp` column as datetime or timestamp, e.g. truncated
datetime value.
Will have to search source code - possibly reports - to see what is
used to convert the `timestamp` column to readable date...

Thanks,

Rey

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h04.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12731 seconds with 13 queries