Re: [Templates] Stringifying objects in templates

[prev] [thread] [next] [Date index for 2004/10/25]

From: Gavin Estey
Subject: Re: [Templates] Stringifying objects in templates
Date: 19:40 on 25 Oct 2004
Drew Taylor wrote:
> In the template I wanted to take the stringified class_date object
> ("2004-10-25 09:00:00") and split on the white space to get the
> individual day and hour components. My first thought was:
> 
>   [day, time] = schedule.class_date.split(' ');
> 

What about being explicit and using strftime?

day = schedule.class_date.strftime('%Y-%m-%d')
time = schedule.class_date.strftime('%H-%M-%S') 

Also Class::Date seems an odd choice, I'm more familiar with Time::Piece.

Gavin.

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Stringifying objects in templates
Drew Taylor 14:26 on 25 Oct 2004

RE: [Templates] Stringifying objects in templates
Jason Gottshall 19:28 on 25 Oct 2004

Re: [Templates] Stringifying objects in templates
Gavin Estey 19:40 on 25 Oct 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52