RE: mysql/php date functions..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: bruce [mailto:bedouglas@xxxxxxxxxxxxx]
> Sent: Monday, September 26, 2005 11:12 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  mysql/php date functions..
> 
> 
> 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 much
> rewrite and use without having to do a lot of initial testing..
> 
> if i create the functions myself, i'm going to need to do 
> initial testing to
> make sure i haven't screwed something up, and i'm on a time crunch!!
> 

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 manipulate a date for a given
instance depends largely on the particulars of that situation.

For instance, if you want to increment a MySQL date column by one day, it
would likely be better to use the MySQL date functions to do it, because to
use PHP, you have to read the date, manipulate it, then write it back,
whereas if you use a SQL statement, you can do it with one DB call.

See:
http://www.php.net/datetime
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html

Cheers!

JM

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux