Re: Date formats from Postgres

From: Date: Fri, 11 May 2001 05:56:21 +0000
Subject: Re: Date formats from Postgres
Groups: php.db 
Request: Send a blank email to php-db+get-9242@lists.php.net to get a copy of this message
Sean, here's a php function that returns a formatted date. This currently returns a US formatted date but you can easily change it to Australian. // convert timestamp to date for display. function displayDate($timeStamp, $separator="/", $leading="f") { $arr = explode("-", $timeStamp); if ($leading == "t") { $month = $arr[1]; $day = $arr[2]; $year = $arr[0]; } else { $month = (integer) $arr[1]; $day = (integer) $arr[2]; $year = (integer) $arr[0]; } return "$month$separator$day$separator$year"; } > I am reading a data datatype from a PostgreSQL database, > > the format sohwing is 2001-01-05 for the 1st of May this year, > > I need this date in Australian format i.e. 01/05/2001, > > I tried using the string date (string format [, int timestamp]) > > but with no success.I am not sure how to convert the database variable into > a timestamp. > > any suggestions ? > > Sean Weissensee Micah -- Micah Woods Woods/IT LLC 2214 Waite Ave. Kalamazoo, MI 49008 v: 616 349-1175 f: 877 349-4929 (toll free) e: micah@woods-it.com w: http://www.woods-it.com

« previous php.db (#9242) next »