Re: DB_DataObject

From: Date: Mon, 25 Oct 2004 16:51:39 +0000
Subject: Re: DB_DataObject
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15095@lists.php.net to get a copy of this message
Alan Knowles 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"); Regards Alan Thank's Alan,
I found a way to format the data from the Database. I have created a toPost() method in my DataObject that find the DB_DATAOBJECT_DATE fields and apply the correct format. But now I'm in trouble with the data insertion. How can I specify the format of data on insert or update? Isn't it a new item for the todo list? I'm sorry for my poor english.

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