Re: Formating MySQL dates

From: Date: Tue, 13 Jun 2000 22:26:20 +0000
Subject: Re: Formating MySQL dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1771@lists.php.net to get a copy of this message
> .....See the date_format function documentation for MySQL. It will provide > the information you are looking for. You can pull the date out of the > database and format it on the fly in your database query. One other alternative is to use UNIX_TIMESTAMP when you retrieve the date. I prefer this approach because Unix timestamps are the best way to perform date arithmetic. Once you're ready to display it, just use date() to format it as you'd like. In fact, one portal site I'm working on now actually stores the date format string as a parameter so users can pick the way they'd like dates displayed to them. Internally, everything is a Unix timestamp and we can ignore all of the locale/formatting issues.

« previous php.general (#1771) next »