5 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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 = (localtime($time))[6];
my $wday2 = (localtime())[6];
print $wday1,"\n", $wday2,"\n";
QuoteIt is worth drawing particular attention to the expected ranges for the
values provided. The value for the day of the month is the actual day
(ie 1..31), while the month is the number of months since January
(0..11). This is consistent with the values returned from localtime()
and gmtime().
print scalar localtime $time;
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";
Froschpopo+2007-11-06 15:10:06--Und die Lösung mit scalar verstehe ich auch nicht.
5 Einträge, 1 Seite |