RE: [PHP] Date & Time Formatting ??

From: Date: Tue, 08 May 2001 16:31:57 +0000
Subject: RE: [PHP] Date & Time Formatting ??
Groups: php.general 
Request: Send a blank email to php-general+get-51930@lists.php.net to get a copy of this message
I think the best way to handle this is not to care what it looks like in the database. Store your dates as UNIX timestamps, and then they are easy to do calculations on and/or convert to any date format you like for displaying in your pages. Read up on date() and mktime() for more info (there are loads of examples in the user notes). HTH Jon -----Original Message----- From: Jack Sasportas [mailto:jack@innovativeinternet.com] Sent: 08 May 2001 17:28 To: php Subject: [PHP] Date & Time Formatting ?? OK I have read many examples, old posts etc, but I am looking for a detailed explanation as to how to do this. First is when I write to a mysql database using the now() function, the time stamp looks like so when I display the time back to the browser. 204:24:06 ( This should have been 12:24pm ) Also the Date Display like so: 2001-05-08 The Goal is to have the Time stamp looking like 12:24 (military time OK) and the date 05-08-2001 or even 05-08-01. The MySQL db looks like so: date 0000-00-00 time 00:00:00 I don't seem to really be able to vary the DB format. Any examples or links to good docs appreciated.... Thanks... ********************************************************************** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' **********************************************************************

« previous php.general (#51930) next »