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 (18436 posts)
Aug 18, 2005, 8:11 AM
Post #2 of 2
Views: 3523
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
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!
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
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!