From ef6b47f7c9acf0b90263bd1cfe2fa2428b1df13a Mon Sep 17 00:00:00 2001 From: Andreas Brachold Date: Tue, 5 Feb 2008 17:15:10 +0000 Subject: * debian-install.sh missed by pakaging * report: RECORDS - status message with wrong id * alist/clist/rlist: reorder sorting parameter, remove double sql query * rlist: move time formating from template to perl code --- lib/Tools.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/Tools.pm') diff --git a/lib/Tools.pm b/lib/Tools.pm index de0c8d4..bcf5800 100644 --- a/lib/Tools.pm +++ b/lib/Tools.pm @@ -49,26 +49,29 @@ use constant WEEKDAYS => qw/Sun Mon Tue Wed Thu Fri Sat/; sub datum { # ------------------ my $zeit = shift || time; - my $typ = shift || 'voll'; + my $typ = lc(shift) || 'voll'; - if(lc($typ) eq 'voll') { + if($typ eq 'voll') { # full date depends locale e.g. 24.12.2007 12:00:00 or 12/24/2007 ... return strftime("%x %X", localtime($zeit)); - } elsif(lc($typ) eq 'tag') { + } elsif($typ eq 'short') { + # short date depends locale e.g. 24.12.2007 12:00 or 12/24/2007 ... + return strftime("%x %H:%M", localtime($zeit)); + } elsif($typ eq 'tag') { # day depends locale e.g. 24.12.2007 or 12/24/2007 return strftime("%x", localtime($zeit)); - } elsif(lc($typ) eq 'weekday') { + } elsif($typ eq 'weekday') { # day depends locale e.g. Fryday ,24.12.2007 return strftime("%A, %x", localtime($zeit)); - } elsif (lc($typ) eq 'int') { + } elsif ($typ eq 'int') { # 1901-01-01T00:00+00:00 return strftime("%Y-%m-%dT%H:%M:%S%z", localtime($zeit)); - } elsif (lc($typ) eq 'rss') { + } elsif ($typ eq 'rss') { # 23 Aug 1999 07:00:00 GMT my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($zeit); return sprintf('%02d %s %04d %02d:%02d:%02d GMT', $mday, (MONTHS)[$mon], $year+1900, $hour, $min, $sec ); - } elsif (lc($typ) eq 'header') { + } elsif ($typ eq 'header') { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($zeit); return sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT", (WEEKDAYS)[$wday],$mday,(MONTHS)[$mon],$year + 1900,$hour,$min,$sec); -- cgit v1.2.3