|
Posted by Jim Moseby on 09/26/05 18:33
> -----Original Message-----
> From: bruce [mailto:bedouglas@earthlink.net]
> 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, 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
[Back to original message]
|