Reply to RE: [PHP] mysql/php date functions..

Your name:

Reply:


Posted by "Chrome" on 09/26/05 23:51

Hi

The PHP time() function returns the number of seconds since the Unix epoch
(Jan 1 1970 midnight) whereas MySQL uses a readable datestamp

See here:

http://dev.mysql.com/doc/mysql/en/datetime.html

for the MySQL date, time and date/time types

and here

http://uk.php.net/manual/en/function.time.php

for time()... instead of using time(), use date() and format it for MySQL

http://uk.php.net/manual/en/function.date.php

That will allow you to use < and > in the SQL statements

HTH

--------
Chrome™
http://www.chrome.me.uk


-----Original Message-----
From: bruce [mailto:bedouglas@earthlink.net]
Sent: 26 September 2005 19:46
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..

john...

that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...

so my question also comes down to .. do i use the php date functions for
date/time manipulation.. or do i use the mysql functions....

any thoughts/suggestions...

-bruce


-----Original Message-----
From: John Nichel [mailto:john@kegworks.com]
Sent: Monday, September 26, 2005 11:19 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date functions..


bruce wrote:
> thanks...
>
> but that's not it john... i'm not worried about creating the sql_statement
> in the php...
>
> i'm concerned that i can't seem to craft/create a basic sql cmd within
mysql
> to get a value (other than NOW()) to work...
>
> if i do (from mysql)
> -->> insert into foo (id, time) values (2, 333333), it doesn't work...
> if i
> -->> insert into foo (id, time) values (2, NOW()), it works!!...
>
> my question is why???

Without knowing the structure of your table, my guess is that the column
time is expecting a valid timestamp, and 333333 is not a valid MySQL
timestamp.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация