RE: [PEAR] Re: DO, DataGrid date format
| From: | Prue | Date: | Mon, 21 Nov 2005 23:01:24 +0000 |
| Subject: | RE: [PEAR] Re: DO, DataGrid date format | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22044@lists.php.net to get a copy of this message | ||
Brilliant!
I was so close and yet so far.
Thanks Justin.
-----Original Message-----
From: Justin Patrin [mailto:papercrane@gmail.com]
Sent: Tuesday, 22 November 2005 9:30 AM
To: prue@clipmagic.com.au
Cc: pear-general@lists.php.net
Subject: Re: [PEAR] Re: DO, DataGrid date format
On 11/21/05, Prue <prue@clipmagic.com.au> wrote:
> Thanks. That's where I'm at.
>
> The field is a mysql DATE not DATETIME. Using the set and get
> examples in the DO manual, I get a windows error about no time element
> in the field. Even changing the format from DATE to DATETIME doesn't
> resolve it.
>
> The example on the SDG page you referenced doesn't show how to format
> dates.
>
> I've tried various combinations in the 'function' field and come up
> with:
>
> - Today's date for every record;
> - 01 Jan 1970 for every record;
> - The last date in the dataset for every record;
> - blank field for every record
> - numerous php errors
>
> ie, almost every combination but the formatted (correct) date for each
> row. Obviously I'm overlooking something and was hoping someone would
> be able to give me a quick fix.
>
Formatter should be something like 'formatMyDate()' *with* the quotes. Then:
function formatMyDate($params) {
return date('d/m/Y', strtotime($params['record']['dateField']));
}
> Prue
>
>
> -----Original Message-----
> From: Mark Wiesemann [mailto:wiesemann@php.net]
> Sent: Tuesday, 22 November 2005 9:08 AM
> To: pear-general@lists.php.net
> Subject: [PEAR] Re: DO, DataGrid date format
>
>
> "Prue" wrote:
>
> > How do I format a date using DataObject and Structures DataGrid?
> >
> > eg, the default output in the datagrid is 2005-11-22 and I would
> > like it to dispay 22 November.
>
> Use a column formatter for the date column, see:
>
> http://pear.php.net/manual/en/package.structures.structures-datagrid.f
> ormatt
> er.php
>
> Mark
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php