Schrift
[thread]6301[/thread]

Kalenderwoche berechnen: Kalenderwoche berechnen (Seite 2)



<< |< 1 2 >| >> 12 Einträge, 2 Seiten
Tom
 2004-06-01 19:23
#82898 #82898
User since
2003-09-20
470 Artikel
BenutzerIn
[Homepage] [default_avatar]
Ich habe ein Modul das noch mehr Möglichkeiten hat, falls du es haben willst sag mir deine Mailaddresse


Hier die Möglichkeiten des Moduls
Quote
get_time
get_date
is_leapyear
days_of_month
weekday
check_form_date
check_date
check_datestring
current_day
month_as_html
sundays
saturdays
elapsed_days
ostern
ostermontag
vatertag
rosenmontag
weiberfastnacht
weeks_of_year
cal_week
muttertag
karfreitag
pfingstsonntag
pfingstmontag
fronleichnam
advent
feiertage
fixtage
f_tage_sort
date_of_current_day
add_days
fridays13th
begin_summertime
end_summertime
is_summertime
show_week


Tom
Computerprobleme??? -> http://www.weber-computerhilfe.de

Fordere keine Anerkennung!
Zeige was und man wird Dich kennen
Crian
 2004-06-02 11:33
#82899 #82899
User since
2003-08-04
5866 Artikel
ModeratorIn
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
sub tag_der_woche ($$$) {
# -----------------------------------------------------------------------------
# sub : t a g _ d e r _ w o c h e
# -----------------------------------------------------------------------------
# Autor : CD
# Aufgabe : Berechnet den Wochentag zu einem Datum.
#
# Vgl. http://www.informatik.uni-ulm.de/pm/mitarbeiter/mark/day_of_week.html
#
# Parameter : Tag (1-31), Monat (1-12) und Jahr (4-Stellig)
# Rückgabewert : 0 (Sonntag) bis 6 (Samstag)
# -----------------------------------------------------------------------------
# 0.0.1 - 17.01.2003 - CD - Erstellt
# 0.0.2 - 20.01.2003 - CD - Funktion ist_schaltjahr verwendet
# -----------------------------------------------------------------------------

my $t = shift;
my $m = shift;
my $j = shift;

print "tag_der_woche: t='$t', m='$m', j='$j'\n" if $Debug > 2;

# Abbruch der Funktion bei falshen Argumentübergaben:
return -1 unless defined($t) and defined($m) and defined($j);
return -2 unless 1 <= $t and $t <= 31;
return -3 unless 1 <= $m and $m <= 12;
return -4 unless 1592 <= $j and $j <= 2299;

my %jahrhundert = (15 => 0,
16 => 6,
17 => 4,
18 => 2,
19 => 0,
20 => 6,
21 => 4,
22 => 2,
);

my $jj = $j % 100; # letzte beiden Ziffern des Jahres
my $jh = int($j / 100); # Jahhundert (erste beide Ziffern des Jahres

my $schalt = ist_schaltjahr($j);
print "jh='$jh', jj='$jj', schalt='$schalt'\n" if $Debug > 2;

my $jhdtcode = $jahrhundert{$jh};
print "jhdtcode='$jhdtcode'\n" if $Debug > 2;

my $jahrcode = $jj + int($jj / 4);
print "jahrcode='$jahrcode'\n" if $Debug > 2;

my @monat = (1-$schalt, 4-$schalt, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6);

my $monatcode = $monat[$m-1];
print "monatcode='$monatcode'\n" if $Debug > 2;

my $tagcode = $jhdtcode + $jahrcode + $monatcode + $t;
--$tagcode; # damit Sonntag auf die 0 fällt...
$tagcode %= 7;
print "tagcode='$tagcode'\n" if $Debug > 2;


return $tagcode;
} # sub tag_der_woche


sub ist_schaltjahr ($) {
# -----------------------------------------------------------------------------
# sub : i s t _ s c h a l t j a h r
# -----------------------------------------------------------------------------
# Autor : CD
# Aufgabe : Gibt an, ob das übergebene Jahr ein Schaltjahr ist.
# Parameter : Jahr
# Rückgabewert : 0 oder 1
# -----------------------------------------------------------------------------
# 0.0.1 - 20.01.2003 - CD - Erstellt
# -----------------------------------------------------------------------------

my $j = shift;

return 1 if $j%4==0 and ($j%100!=0 or $j%400==0);
return 0;
} # sub ist_schaltjahr
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite
<< |< 1 2 >| >> 12 Einträge, 2 Seiten



View all threads created 2004-06-01 17:05.