Leser: 3
|< 1 2 >| | 14 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
sub getDayName { use Time::Local; my $day = shift; # DD || D my $month = shift; # MM || M my $year = shift; # YYYY my $info = scalar( localtime( timelocal(0,0,0,$day,$month-1,$year) ) ); my @parts = split / /, $info; my %days = ( "Mon" => "Mo", "Tue" => "Di", "Wed" => "Mi", "Thu" => "Do", "Fri" => "Fr", "Sat" => "Sa", "Sun" => "So" ); my $weekDay = $days{$parts[0]}; return $weekDay; }
my $info = scalar( localtime( timelocal(0,0,0,$day,$month-1,$year) ) );
my $weekDay = $days{$parts[0]};
1 2 3 4 5 6 7 8
sub getDayName { use Time::Local; my ($day, $month, $year) = @_; my $weekDay = ( localtime( timelocal(0,0,0,$day,$month-1,$year) ) ) [6]; my @name = qw( So Mo Di Mi Do Fr Sa ); return $name[$weekDay]; }
styx-cc+2007-12-08 12:29:49--bloonix: leider ist DateTime kein Coremodul
cpan -i DateTime
1 2 3 4 5 6 7
use POSIX 'strftime'; sub get_day_name { my ( $day, $month, $year ) = @_; my $week_day = strftime '%w', 0, 0, 0, $day, $month - 1, $year; return ( qw( So Mo Di Mi Do Fr Sa ) )[ $week_day ]; }
return qw( So Mo Di Mi Do Fr Sa ) [ $week_day ];
1 2 3 4
package Time::Strftime; use POSIX 'strftime'; use Exporter; @EXPORT = 'strftime';
|< 1 2 >| | 14 Einträge, 2 Seiten |