Darren Ferguon - Weblog

Perl - Format Date

Format the current date using the Date::Format library. for available formats see this page.

Marco Tag

<?PERL_MACRO id="date" format="%C"></?PERL_MACRO>

Marco Output

PERL FOR UMBRACO: The remote server returned an error: (404) Not Found. requesting http://www.darren-ferguson.com:80/plex/date.plex

Perl Source

use strict;
use utf8;
use CGI;
use Date::Format;

my $query = new CGI;
print $query->header(-charset => 'utf-8');
my $format = $query->param('format');
if($format) {
	print time2str($format, time);
} else {
	print 'no format string specified';
}