Gossamer Forum
Quote Reply
*REALLY* annoying bug :/
Hi,

Not sure if anyone else has encountered this problem - but I'm having a hell of a time with dates in the templates :(

If we pass in a date - i.e 2007-10-21 , it AUTOMATICALLY gets converted into the %ddd% %mmm% %dd% %yyyy% format.

This is a real PITA on the current plugin I'm working on (I've managed to get around it, but I'm not happy at the way I've had to do it :()

I basically had to convert dates being passed into the template - so:

2007-10-21

..becomes:

2007 - 10 - 21

Then, pass it BACK to a function, to replace the - to normal - i.e:

Code:
sub {

my $date = $_[0];
$date =~ s/ - /-/sig;
return $date;

}

Surely there has to be a better way than this? Not very elegant at all - although it does work now (which is something)

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] *REALLY* annoying bug :/ In reply to
How about using something like:
<%GT::Date::date_transform($Date,'%mmm% %dd%, %yyyy%','%yyyy%-%mm%-%dd%')%>
?
Quote Reply
Re: [gotze] *REALLY* annoying bug :/ In reply to
Hi,

Tried that, but all it ever did, was return in the format I didn't want it in :( That why it was so annoying :P

Thanks anyway.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!