Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
October 27, 2007, 7:57 pm
rate this thread
Re: Formatting a date with php from a mysql table
It does, but often it makes more sense to let MySQL return an already
formatted date. Have a look at the DATE_FORMAT() function.
The main reason is that it avoids the conversion of the date to a Unix
timestamp. These timestamps are much more restricted in range (typically
1970-2038, back to 1902 with negative values) than MySQL timestamps and
should be avoided when they're not really necessary like in this case.
And just in case your script still has to work with Unix timestamps, the
DB can also do this conversion work for you with UNIX_TIMESTAMP(). I
would prefer that instead of a strtotime() call.
- » determine of part of string is uppercase, based on requirements
- — Next thread in » PHP Scripting Forum