can anyone tell me how would i convert yyyymmdd to yyyy,mm,dd. Like i am getting a date as 20051004 which i want like 2005,10,04. Can anyone help me with that.
Aug 18, 2005, 8:11 AM
Veteran / Moderator (17298 posts)
Aug 18, 2005, 8:11 AM
Post #2 of 2
Views: 1098
Hi,
Should be as simple as;
if ($str =~ m/([\d\d\d\d]?)([\d\d]?)([\d\d]?)/) {
my $new_date = qq{$1,$2,$3};
}
Probably could be done better.. but that should 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
Should be as simple as;
Code:
my $str = '20040512'; if ($str =~ m/([\d\d\d\d]?)([\d\d]?)([\d\d]?)/) {
my $new_date = qq{$1,$2,$3};
}
Probably could be done better.. but that should 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

