RE: [PHP] Date & Time Formatting ??

From: Date: Tue, 08 May 2001 16:53:04 +0000
Subject: RE: [PHP] Date & Time Formatting ??
Groups: php.general 
Request: Send a blank email to php-general+get-51934@lists.php.net to get a copy of this message
Are you *absolutely sure* that mysql_result($db_result, $dbrecord, 'date') contains a UNIX timestamp? IOW, if I inserted the lines: $unixdate = mysql_result($db_result,$db_record,'date'); echo $unixdate; I would see something like "989393400" on the screen? (Speaking from experience, I got this hugely messed up first time round... search for one of my posts a few months ago where I was passing a string to the date function if you fancy a chuckle....) Cheers Jon -----Original Message----- From: Jack Sasportas [mailto:jack@innovativeinternet.com] Sent: 08 May 2001 17:46 To: php Subject: Re: [PHP] Date & Time Formatting ?? Here is what I am trying to do, but I get the wrong date: $t_data_array[1]=date("m/d/y",mysql_result($db_result,$db_record,'date')); Then I simply print the value in the array....this date instead of 05/08/01 comes out 12/31/69 Thanks! Jon Haworth wrote: > 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 ********************************************************************** '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 (#51934) next »