Re: Help with Timestamp
| From: | Geoff A. Virgo | Date: | Wed, 07 Aug 2002 19:26:06 +0000 |
| Subject: | Re: Help with Timestamp | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2308@lists.php.net to get a copy of this message | ||
Erich,
MySQL's timestamp(14) format is like so: YYYYMMDDHHMMSS. So display it in numbers you'll need to write a function which splits the string into it's components. See the String Functions section of the PHP Manual for this (http://www.php.net/manual/en/ref.strings.php). To display as a textual string (ie. Jan. 01, 2002) you's then need to use those components to create a Unix timestamp and convert that timestamp (see the Date Functions... http://www.php.net/manual/en/ref.datetime.php). Since you can easily display a Unix timestamp in any format you choose with the date functions, a much easier and more sensible way of doing things is to convert the db's date field into a INT(11) type and store your date information as a Unix time stamp.
At 01:39 PM Tuesday, 8/6/2002, you wrote:
I am storing date/time information in a MySQL DB as timestamp(14). How do I display this as a readable date when selecting from the db? -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-geoff ---------- * always let the wookie win *