Re: Re: DB_DataObject

From: Date: Mon, 25 Oct 2004 15:15:32 +0000
Subject: Re: Re: DB_DataObject
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15092@lists.php.net to get a copy of this message
On Mon, 25 Oct 2004 08:56:39 +0800, Alan Knowles <alan@akbkhome.com> wrote: > Edvan Cunha wrote: > > I'm working with PostgreSQL and, when I execute a find(), all date > > fields on DB_DataObjects come with an undesired date format. How can I > > set the datestyle on the find() method of DataObjects? > > DataObjects should use the native date style in the database, - there > isnt anything magic done on find/fetching (unless you override those > methods) > > eg. echo $do->{datecolumn}; > > however using the overloaded get{datecolumn}() methods, may run it > through the Date class. (and defaults to ISO) > > you can use the overloaded methods to get formated dates, by using the > strftime format as the argument in the get method. > $date = $do->get{datecolumn}("%d/%m/%Y"); > But if you use oerloading in PHP4 your script may crash with strange errors and passing things by reference into a function will likely not work anymore. I would suggest putting in your own get function and having it call the internal one unless you're using PHP5. -- paperCrane --Justin Patrin--

« previous php.pear.general (#15092) next »