Thread timelocal Wochentag? (4 answers)
Opened by Froschpopo at 2007-11-06 04:01

Froschpopo
 2007-11-06 16:10
#101908 #101908
User since
2003-08-15
2653 Artikel
BenutzerIn
[default_avatar]
So ganz verstehe ich das nicht. Es geht doch um den Wochentag, also der wievielte Tag einer Woche ist.
Und die Lösung mit scalar verstehe ich auch nicht.
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl

use strict;
use Time::Local;

my $date = "2007-11-06 02:15:04";
my @times = $date =~ /(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/;

my $time = timelocal(reverse @times);

my $wday1 = scalar((localtime($time))[6]);
my $wday2 = (localtime())[6];


print $wday1,"\n", $wday2,"\n";

View full thread timelocal Wochentag?