[PHP] mysql/php date functions..

2005-09-26 Thread bruce
hi... can anybody point me to a good/basic tutorial (tested) for php/mysql date functions... basically, i want to store a date/time in a column, and be able to read it, manipulate it, and update the table. i've seen various articles/sample code, but i'm looking for something that i cna pretty

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

2005-09-26 Thread Jim Moseby
-Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 11:12 AM To: php-general@lists.php.net Subject: [PHP] mysql/php date functions.. hi... can anybody point me to a good/basic tutorial (tested) for php/mysql date functions... basically

Re: [PHP] mysql/php date functions..

2005-09-26 Thread Silvio Porcellana
Jim Moseby wrote: Hi Bruce! MySQL and PHP both have extensive built-in date functions that are clearly documented and extraordinarily easy to use. For the vast majority of situations, there is no need to manually write any custom date-handling code. The decision to use MySQL or PHP to

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

2005-09-26 Thread bruce
-Original Message- From: Silvio Porcellana [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 8:51 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql/php date functions.. Jim Moseby wrote: Hi Bruce! MySQL and PHP both have extensive built-in date functions that are clearly

Re: [PHP] mysql/php date functions..

2005-09-26 Thread John Nichel
bruce wrote: how can i create a mysql sql statement to insert a php 'time()' into mysql? i've got the mysql var 't1, timestamp' but i can't figure out how to do an insert $q = time(); $sql = sprintf(insert into foo (id, ctime) values(%d, %???), $id, $q); can't figure out how to get this to

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

2005-09-26 Thread bruce
), it doesn't work... if i -- insert into foo (id, time) values (2, NOW()), it works!!... my question is why??? -bruce -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 11:00 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql/php date

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

2005-09-26 Thread bruce
, September 26, 2005 11:00 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql/php date functions.. bruce wrote: how can i create a mysql sql statement to insert a php 'time()' into mysql? i've got the mysql var 't1, timestamp' but i can't figure out how to do an insert $q = time

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

2005-09-26 Thread Chris W. Parker
bruce mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 11:13 AM said: 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... [snip] my question is why??? MySQL timestamps are different from UNIX timestamps. Chris.

Re: [PHP] mysql/php date functions..

2005-09-26 Thread John Nichel
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

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

2005-09-26 Thread bruce
but that still doesn't explain why i can't slam some value directly into the timestamp var within the mysql tbl... -Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 11:15 AM To: php-general@lists.php.net Subject: RE: [PHP] mysql/php date

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

2005-09-26 Thread bruce
-Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] 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

Re: [PHP] mysql/php date functions..

2005-09-26 Thread John Nichel
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

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

2005-09-26 Thread Jim Moseby
-Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:46 PM 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

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

2005-09-26 Thread bruce
Nichel [mailto:[EMAIL PROTECTED] 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

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

2005-09-26 Thread bruce
bruce -Original Message- From: bruce [mailto:[EMAIL PROTECTED] 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

Re: [PHP] mysql/php date functions..

2005-09-26 Thread John Nichel
bruce wrote: 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? I don't convert it. I store the UNIX timestamp in an INT(11) column. also, once you

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

2005-09-26 Thread Chris W. Parker
John Nichel mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 12:43 PM said: I don't convert it. I store the UNIX timestamp in an INT(11) column. This is going to be a basic question I'm sure but why INT and not VARCHAR? Is it simply because a timestamp is a number? Chris. -- PHP

Re: [PHP] mysql/php date functions..

2005-09-26 Thread Kristen G. Thorson
- the php var? thanks bruce -Original Message- From: bruce [mailto:[EMAIL PROTECTED] 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

Re: [PHP] mysql/php date functions..

2005-09-26 Thread John Nichel
Chris W. Parker wrote: John Nichel mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 12:43 PM said: I don't convert it. I store the UNIX timestamp in an INT(11) column. This is going to be a basic question I'm sure but why INT and not VARCHAR? Is it simply because a timestamp is

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

2005-09-26 Thread Chrome
] 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

[PHP] mysql/php date functions..

2005-09-26 Thread info
Hello Bruce, While the date functions are well documented - http://php.net/date - here is a little example to manipulate the date with php, rather than mysql: // set the new expiry date // DATE FUNCTIONS FOR THE EXPIRY MODULE // first perform date arithmetic $listingExpiry = mktime