You are here: RE: [PHP] mysql/php date functions.. « PHP « IT news, forums, messages
RE: [PHP] mysql/php date functions..

Posted by "bruce" on 09/26/05 22:44

or.. better yet.

if i do a php -> time(), i get a unix_timestamp var. how do you guys store
this in mysql. you can't simply do an insert into a mysql/timestamp var. so
how do you convert it?

also, once you have the mysql tbl, how do you go from the mysql timestamp
var ->> the php var?

thanks

bruce


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


so you play with the time/date vars on the php side, and then simply store
them in the mysql tbl as a int(10)... or do you actually store the vars in
the mysql timestamp...

and then use the mysql date/time functions...

ie. how would you do the following...

get a date (date1)
get a date (date2)
store the date1/time in mysql
add the date1 + date2 and store the result in mysql
read the result from mysql, with the result being in the year/month/date
format

------

or,

would you just get the unix_timestamp representation of the dates, and store
the 10 int formats in the mysql tbl. you could then extract/select the date
information from the tbls, and do all the date calculations in php...

the downside to this is that you'd have to convert all the date information
from mysql to a human readable format...

thoughts/comments/etc...

-bruce


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


bruce wrote:
> 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

Personal preference I guess. Me, I use UNIX timestamps.

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

 

Navigation:

[Reply to this 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

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