Re: DATE(r)

From: Date: Fri, 09 Sep 2005 20:07:38 +0000
Subject: Re: DATE(r)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-40242@lists.php.net to get a copy of this message
Ron, Unless you have a good reason for doing it this way round, I suggest you would be better off using the database's own date function. Pretty much any db will have TODAY() or DATE() type functions. Advantages- a) They will emit the data in the right format, in fact you can just insert the function
    straight into the update command.
b) You have one notion of time, the database server's. You may have everything on one
    machine today, but tomorrow you might move the RDBMS to it's own server, and
    then you have the opportunity for clocks being out of sync. If you always use the
    clock time from the db server you have one reference.
Regards: Colin
Subject: DATE(r) From: "Ron Piggott" <ron.php@actsministries.org> Date: Fri, 9 Sep 2005 12:52:59 -0500 To: "PHP DB" <php-db@lists.php.net> To: "PHP DB" <php-db@lists.php.net> Question: I am trying to for the first time create a table with a column that is defined as datetime I wanted to populate that column with the date(r) command. date(r) on my web site gives this response: Fri, 9 Sep 2005 13:32:19 -0400 How may I manipulate date(r) to give a format which is compatable to the column type 0000-00-00 00:00:00 YYYY-MM-DD 24:59:59 Ron


« previous php.db (#40242) next »