Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Paul
On Thursday, 03 November, 2011 at 02:31:56 GMT, Santiago Zarate wrote: If i'm not wrong, being basically a DateTime object you should be able to do whatever you like with it instead of having to do a search replace, consider using DBIx::Class::InflateColumn to have DBIx do the job for you every

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Tomas Doran
On 3 Nov 2011, at 02:05, Adam Jimerson wrote: 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 As other people have noted, what's happening is that DateTime::Format:Pg is

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Adam Jimerson
The problem I see with doing it this way: $formatted_date_string = $c-model('DB::TableName')-find($row_index)-date_field-mdy('/'); is that It looks like I would have to do this every time I grab a date from the database. That is fine but there are times in my app where I pull everything from the

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Kieren Diment
On 03/11/2011, at 9:40 PM, Adam Jimerson wrote: The problem I see with doing it this way: $formatted_date_string = $c-model('DB::TableName')-find($row_index)-date_field-mdy('/'); is that It looks like I would have to do this every time I grab a date from the database. That is fine but there

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Adam Jimerson
On Thu, Nov 3, 2011 at 6:55 AM, Kieren Diment dim...@gmail.com wrote: On 03/11/2011, at 9:40 PM, Adam Jimerson wrote: The problem I see with doing it this way: $formatted_date_string = $c-model('DB::TableName')-find($row_index)-date_field-mdy('/'); is that It looks like I would have to

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Tomas Doran
On 3 Nov 2011, at 12:21, Adam Jimerson wrote: Also would it accept a ymd hms format or do they have to be separate? Please see the fine documentation for DateTime. Another option is to add a 'format_date' method to your view, and use the expose_methods config setting for View::TT.. In

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread will trillich
On Thu, Nov 3, 2011 at 12:36 PM, Tomas Doran bobtf...@bobtfish.net wrote: Another option is to *add a 'format_date' method to your view*, and use the *expose_methods *config setting for View::TT.. In your TT code you'd then say [% WHILE (row = mydata_rs.next);

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Tomas Doran
On 3 Nov 2011, at 15:38, will trillich wrote: Aha, that's what http://search.cpan.org/~mstrout/Catalyst-View-TT-0.37/lib/Catalyst/View/TT.pm#expose_methods is talking about. Hadn't noticed that before. Not noticed it before (fair enough), or not clear enough in the documentation? Cheers

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Adam Jimerson
On Thu, Nov 3, 2011 at 11:38 AM, will trillich will.trill...@serensoft.comwrote: On Thu, Nov 3, 2011 at 12:36 PM, Tomas Doran bobtf...@bobtfish.netwrote: Another option is to *add a 'format_date' method to your view*, and use the *expose_methods *config setting for View::TT.. In your TT

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread will trillich
Catalyst sure is wide and deep. One can get a reasonably advanced app running in Catalyst without knowing broad stretches of what goes on, or *can* go on, under the hood. There's so much possible, and so many handy methods and plugins that you're gonna A) overlook things on the mad dash to the

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Tomas Doran
On 3 Nov 2011, at 19:03, will trillich wrote: In order to have 'perfect documentation' it must meet two criteria: A) explain the utility and usage (benefits and how-to) in a way that I can grok and B) show up on my radar in my searches. Both of these depend a helluva lot on my own

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread will trillich
Pushy, pushy. :) I'll see what I can come up with. On Thu, Nov 3, 2011 at 2:29 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 3 Nov 2011, at 19:03, will trillich wrote: In order to have 'perfect documentation' it must meet two criteria: A) explain the utility and usage (benefits and

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-03 Thread Denny
On Thu, 2011-11-03 at 15:20 -0500, will trillich wrote: The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey Good .sig quote for a thread about documentation :) ___ List:

[Catalyst] Dealing with timestamps from Postgres

2011-11-02 Thread Adam Jimerson
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

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-02 Thread Santiago Zarate
If i'm not wrong, being basically a DateTime object you should be able to do whatever you like with it instead of having to do a search replace, consider using DBIx::Class::InflateColumn to have DBIx do the job for you every time you need to use that specific model... On Wed, Nov 2, 2011 at

Re: [Catalyst] Dealing with timestamps from Postgres

2011-11-02 Thread Rippl, Steve
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