Gossamer Forum
Home : General : Perl Programming :

Mmm.. weird thing with GT::Date

Quote Reply
Mmm.. weird thing with GT::Date
Hi,

I'm trying to convert a date - but its just refusing to work :/

Example value for $ssl_exp_date is: Aug 14 23:59:59 2009 GMT

The code I'm trying is:

Code:
$ssl_exp_date =~ s/\n//;
$ssl_exp_date =~ s/ GMT//;
# Aug 14 23:59:59 2009
my $old_format = '%mmm% %dd% %hh%:%mm%%:%ss% %yyyy%';
my $new_format = '%yyyy%-%mm%-%dd%';

I've trimmed the \n from $ssl_exp_date, as that existed from openssl - and then removed GMT, just in case that was throwing it off.

I'm sure I've just missed something *really* simple - but I can't spot it :(

Any suggestions are welcome.

TIA

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Mmm.. weird thing with GT::Date In reply to
Ok, not sure if maybe its something to do with the hh:mm:ss bit, but doing:

Code:
$ssl_exp_date =~ s/\n//;
$ssl_exp_date =~ s/ GMT//;
$ssl_exp_date =~ s/ \d\d:\d\d:\d\d//;

my $old_format = '%mmm% %dd% %yyyy%';
my $new_format = '%yyyy%-%mm%-%dd%';

...seems to have made it work :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Mmm.. weird thing with GT::Date In reply to
Quote:
but its just refusing to work

...is not very helpful.
Quote Reply
Re: [Andy] Mmm.. weird thing with GT::Date In reply to
Your minute format is incorrect. Numerical minutes is %MM%, not %mm% - that's numerical month.

Adrian
Quote Reply
Re: [brewt] Mmm.. weird thing with GT::Date In reply to
hahaha had to be a simple one <G> Thanks for clearing that up :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

Last edited by:

Andy: Nov 6, 2008, 11:59 PM