One way (if using DBIx::Class)

$dt_object = $c->model('DB::TableName')->find($row_index)->date_field

(or however your get your resultset)

$formatted_date_string = $dt_object->mdy('/');

where the mdy('/') can be whatever the DateTime object you're retrieving
supports (see CPAN docs).

Can obviously be combined into

$formatted_date_string =
 $c->model('DB::TableName')->find($row_index)->date_field->mdy('/');

I just split it up to illustrate where the DateTime object is coming from.




On Wed, Nov 2, 2011 at 7:05 PM, Adam Jimerson <vend...@gmail.com> wrote:

> I'm hoping someone can help me with an issue that I am having with dates
> and timestamps that I am pulling out of my Postgres server.
> In my database my time stamps are stored like this 2011-05-07 13:53:41-04
> (timestamp with time zone), but in my Catalyst app the
> date looks like this 2011-05-07T13:53:41.  The "T" instead of the space is
> driving me crazy, I think it is coming from DateTime::Format:Pg
> which Catalyst had me install when I first set up my application to use
> the database.  Other than doing a find and replace then stash the
> results every time I want to pull back a date or timestamp is
> there something else that I can do?
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- 
Steve Rippl
Technology Director
Woodland Public Schools
360 841 2730
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to