Hi,
Heres a handy little global that I thought I'd share. Simply pass in yyyy-mm-dd format, or dd-mm-yyyy [US format] [UK format]), and it will return it in a "nice" format.
For example;
..would show as;
...and;
..would show up as;
simply call with;
<%global_name($DATE_FIELD)%>
my @months = qw/January February March April May June July August September October November December/;
my @dayextensions = qw/1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th 31st/;
my $date = $_[0];
if ($date =~ /^\d\d\d\d\-\d\d\-\d\d$/) {
my ($yyyy,$mm,$dd) = split /-/, $date;
$mm =~ s/^0//;
$dd =~ s/^0//;
my $dback = $dayextensions[$dd-1];
my $mback = $months[$mm-1];
my $yback = $yyyy;
return qq{$dback $mback $yback}
} else {
my ($dd,$mm,$yyyy) = split /-/, $date;
$mm =~ s/^0//;
$dd =~ s/^0//;
my $dback = $dayextensions[$dd-1];
my $mback = $months[$mm-1];
my $yback = $yyyy;
return qq{$dback $mback $yback}
}
}
Hope that helps someone :)
Cheers
Andy (mod)
andy@ultranerds.com
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
Heres a handy little global that I thought I'd share. Simply pass in yyyy-mm-dd format, or dd-mm-yyyy [US format] [UK format]), and it will return it in a "nice" format.
For example;
Quote:
2004-01-30..would show as;
Quote:
30th January 2004....and;
Quote:
10-02-2005..would show up as;
Quote:
10th February 2005simply call with;
<%global_name($DATE_FIELD)%>
Code:
sub { my @months = qw/January February March April May June July August September October November December/;
my @dayextensions = qw/1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th 31st/;
my $date = $_[0];
if ($date =~ /^\d\d\d\d\-\d\d\-\d\d$/) {
my ($yyyy,$mm,$dd) = split /-/, $date;
$mm =~ s/^0//;
$dd =~ s/^0//;
my $dback = $dayextensions[$dd-1];
my $mback = $months[$mm-1];
my $yback = $yyyy;
return qq{$dback $mback $yback}
} else {
my ($dd,$mm,$yyyy) = split /-/, $date;
$mm =~ s/^0//;
$dd =~ s/^0//;
my $dback = $dayextensions[$dd-1];
my $mback = $months[$mm-1];
my $yback = $yyyy;
return qq{$dback $mback $yback}
}
}
Hope that helps someone :)
Cheers
Andy (mod)
andy@ultranerds.com
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


