220
Bearbeitungen
Änderungen
Die Seite wurde neu angelegt: „<includeonly> {{#vardefine: currentTime | {{CURRENTTIMESTAMP}} }} {{#vardefine: weekday | {{{Wochentag}}} }} {{#vardefine: interval | {{{Intervall}}} }} {…“
<includeonly>
{{#vardefine: currentTime |
{{CURRENTTIMESTAMP}}
}}
{{#vardefine: weekday |
{{{Wochentag}}}
}}
{{#vardefine: interval |
{{{Intervall}}}
}}
{{#vardefine: time |
{{#pad: {{#pad: {{#sub: {{{Uhrzeit}}} | 0 | 2 }} | 4 | {{#sub: {{{Uhrzeit}}} | 3 | 2 }} | right }} | 6 | 0 | right }}
}}
{{#vardefine: currentYear |
{{#sub: {{#var:currentTime}} | 0 | 4 }}
}}
{{#vardefine: currentMonth |
{{#sub: {{#var:currentTime}} | 4 | 2 }}
}}
{{#vardefine: isLeapyear |
{{#ifexpr: ({{#var: currentYear}} mod 400) = 0 | 1 |
{{#ifexpr: ({{#var: currentYear}} mod 100) = 0 | 0 |
{{#ifexpr: ({{#var: currentYear}} mod 4) = 0 | 1 | 0 }}
}}
}}
}}
{{#vardefine: daysOfMonth |
{{#switch: {{#var: currentMonth}}
|01 = 31
|02 = {{#ifeq: {{#var: isLeapyear}} | 1 | 29 | 28 }}
|03 = 31
|04 = 30
|05 = 31
|06 = 30
|07 = 31
|08 = 31
|09 = 30
|10 = 31
|11 = 30
|12 = 31
}}
}}
{{#vardefine: firstDayOfCurrentMonth |
{{#time: D |
{{#pad: {{#var: currentYear}} | 14 |
{{#pad: {{#var: currentMonth}} | 10 | 01000000 | right}} |
right
}}
}}
}}
{{#vardefine: firstDesiredWeekday |
{{#switch: {{#var: weekday}}
|Mo = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 1
|Di = 7
|Mi = 6
|Do = 5
|Fr = 4
|Sa = 3
|So = 2
}}
|Di = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 2
|Di = 1
|Mi = 7
|Do = 6
|Fr = 5
|Sa = 4
|So = 3
}}
|Mi = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 3
|Di = 2
|Mi = 1
|Do = 7
|Fr = 6
|Sa = 5
|So = 4
}}
|Do = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 4
|Di = 3
|Mi = 2
|Do = 1
|Fr = 7
|Sa = 6
|So = 5
}}
|Fr = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 5
|Di = 4
|Mi = 3
|Do = 2
|Fr = 1
|Sa = 7
|So = 6
}}
|Sa = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 6
|Di = 5
|Mi = 4
|Do = 3
|Fr = 2
|Sa = 1
|So = 7
}}
|So = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 7
|Di = 6
|Mi = 5
|Do = 4
|Fr = 3
|Sa = 2
|So = 1
}}
}}
}}
{{#vardefine: nextDatesYear |
{{#ifexpr: ({{#var: currentMonth}} + 1) > 12 |
{{#expr: ({{#var: currentYear}} + 1 )}} |
{{#var: currentYear}}
}}
}}
{{#vardefine: nextMonth |
{{#ifexpr: ({{#var: currentMonth}} + 1) > 12 |
01 |
{{#ifexpr: {{#var: currentMonth}} + 1 > 9 |
{{#expr: {{#var: currentMonth}} + 1 }} |
{{#pad: {{#expr: {{#var: currentMonth}} + 1 }} | 2 | 0 | left }}
}}
}}
}}
{{#vardefine: firstDayOfNextMonth |
{{#time: D |
{{#pad: {{#var: nextDatesYear}} | 14 |
{{#pad: {{#var: nextMonth}} | 10 | 01000000 | right}} |
right
}}
}}
}}
{{#vardefine: daysOfNextMonth |
{{#switch: {{#var: nextMonth}}
|01 = 31
|02 = {{#ifeq: {{#var: isLeapyear}} | 1 | 29 | 28 }}
|03 = 31
|04 = 30
|05 = 31
|06 = 30
|07 = 31
|08 = 31
|09 = 30
|10 = 31
|11 = 30
|12 = 31
}}
}}
{{#vardefine: firstDesiredWeekdayNextMonth |
{{#switch: {{#var: weekday}}
|Mo = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 1
|Di = 7
|Mi = 6
|Do = 5
|Fr = 4
|Sa = 3
|So = 2
}}
|Di = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 2
|Di = 1
|Mi = 7
|Do = 6
|Fr = 5
|Sa = 4
|So = 3
}}
|Mi = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 3
|Di = 2
|Mi = 1
|Do = 7
|Fr = 6
|Sa = 5
|So = 4
}}
|Do = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 4
|Di = 3
|Mi = 2
|Do = 1
|Fr = 7
|Sa = 6
|So = 5
}}
|Fr = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 5
|Di = 4
|Mi = 3
|Do = 2
|Fr = 1
|Sa = 7
|So = 6
}}
|Sa = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 6
|Di = 5
|Mi = 4
|Do = 3
|Fr = 2
|Sa = 1
|So = 7
}}
|So = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 7
|Di = 6
|Mi = 5
|Do = 4
|Fr = 3
|Sa = 2
|So = 1
}}
}}
}}
{{#vardefine: firstDate
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekday}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: secondDate |
{{#ifexpr: ({{#var: firstDesiredWeekday}} + 7) > 9
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 7}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#pad: {{#expr: {{#var: firstDesiredWeekday}} + 7}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: thirdDate |
{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 14}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fourthDate |
{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 21}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fifthDate |
{{#ifexpr: ({{#var: firstDesiredWeekday}} + 28) <= {{#var: daysOfMonth}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 28}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekdayNextMonth}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: firstDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekdayNextMonth}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: secondDateNextMonth |
{{#ifexpr: ({{#var: firstDesiredWeekdayNextMonth}} + 7) > 9
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 7}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 7}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: thirdDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 14}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fourthDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 21}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fifthDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 28}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: lastDate |
{{#ifeq: {{#var: currentMonth}} |
{{#sub: {{#var: fifthDate}} |
4 |
2}} |
{{#var: fifthDate}} |
{{#var: fourthDate}}
}}
}}
{{#vardefine: lastDateNextMonth |
{{#ifexpr: ({{#var: daysOfNextMonth}} - {{#sub:
{{#var: fifthDateNextMonth}} |
4 |
2}}) < 0 |
{{#var: fourthDateNextMonth}} |
{{#var: fifthDateNextMonth}}
}}
}}
{{#vardefine: result |
{{#switch: {{#var: interval}}
| 1 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}}
}}
}}
| 2 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#var: firstDateNextMonth}}
}}
}}
| 3 = {{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#var: secondDateNextMonth}}
}}
}}
| 4 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#var: firstDateNextMonth}}
}}
| 5 = {{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#var: secondDateNextMonth}}
}}
| 6 = {{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#var: thirdDateNextMonth}}
}}
| 7 = {{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#var: fourthDateNextMonth}}
}}
| 8 = {{#ifexpr: {{#time: W | {{#var: firstDate}} }} mod 2 = 0 |
{{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: {{#time: W | {{#var: firstDateNextMonth}} }} mod 2 = 0 |
{{#var: firstDateNextMonth}} |
{{#var: secondDateNextMonth}}
}}
}}
}}
}}
| 9 = {{#ifexpr: {{#time: W | {{#var: firstDate}} }} mod 2 != 0 |
{{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: {{#time: W | {{#var: firstDateNextMonth}} }} mod 2 != 0 |
{{#var: firstDateNextMonth}} |
{{#var: secondDateNextMonth}}
}}
}}
}}
}}
| 10 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}}
| 11 = {{#ifexpr: ({{#var: lastDate}} - {{#var:currentTime}}) > 0 |
{{#var: lastDate}} |
{{#var: lastDateNextMonth}}
}}
| 13 = {{#ifexpr:{{LOCALMONTH}}=12 AND {{LOCALDAY}}>{{{Tag|{{{1|1}}}}}}|{{#expr:{{LOCALYEAR}}+1}}01|{{LOCALYEAR}}{{#ifexpr:{{LOCALDAY}}>{{{Tag|{{{1|1}}}}}}|{{#ifexpr:{{LOCALMONTH}}+1<10|0}}{{#expr:{{LOCALMONTH}}+1}}|{{LOCALMONTH}}}}}}{{#ifexpr:{{{Tag|{{{1|1}}}}}}<10|0|}}{{{Tag|{{{1|1}}}}}}{{#var: time}}
}}
}}
{{#var: result}}
</includeonly><noinclude>__NOTOC__
----
Diese Vorlage generiert automatisch einen Timestamp anhand der Vorgaben Wochentag, intervall und Uhrzeit.<br>
Die Ausgabe erfolgt im Format YYYYMMDDhhmmss, bspw. {{CURRENTTIMESTAMP}} für jetzt(bzw. vor zwei stunden, da das wiki eine andere Lokalzeit hat).
=== Benutzung ===
Erstellt eine eigene Vorlage für euren Stammtisch, die folgendes enthält:
<pre>
{{Vorlage:Nächster Stammtisch
| Wochentag = Mo
| Intervall = 1
| Uhrzeit = 19:45
}}
</pre>
Diese Vorlage erzeugt beim Aufruf einen Timestamp entsprechend dem gewünschten Intervall. Hier der Schlüssel für die Intervalle (einfach die gewünschte Zahl verwenden):
<pre>
1 : jede Woche
2 : jeden 1. und 3.
3 : jeden 2. und 4.
4 : jeden 1.
5 : jeden 2.
6 : jeden 3.
7 : jeden 4.
8 : jede gerade Woche (nach ISO 8601 mit Montag beginnend)
9 : jede ungerade Woche (nach ISO 8601 mit Montag beginnend)
10: jeden 1., 3. und 5.
11: jeden Letzten des Monats
13: jedes bestimmte Monatsdatum, beispielsweise jeder 5. (Anzugeben mit dem Parameter Tag)
</pre>
Diesen Timestamp könnt ihr dann auf eurer Seite mit der funktion
<pre>
{{#time: ZEITFORMAT | TIMESTAMP}}
</pre>
in ein lesbares Datum umwandeln.
ZEITFORMAT entsprich dabei einem Formatierungsstring, mehr Infos zur Formatierung gibt es [http://de.wikipedia.org/wiki/Hilfe:Vorlagenprogrammierung#Funktion_time hier]<br>
Ein Beispiel wäre:
<pre>
{{#time: l, \d\e\n d.m.Y \u\m H:i \U\h\r | 20100515184500 }}
</pre>
Das Resultat wäre:
<pre>
Samstag, den 15.05.2010 um 18:45 Uhr
</pre>
Anstelle von TIMESTAMP könnt ihr entweder manuell einen Timestamp eintragen, wie im Beispiel, oder für regelmäßige Termine gebt ihr hier eure oben erstellte Vorlage an.
=== Ersteller ===
Diese Vorlage wurde von [[http://wiki.piratenpartei.de/wiki/Benutzer:Isabaellchen|Isabaellchen]] erstellt.
=== Bezüge ===
Diese Vorlage verwendet keine Vorlage<br/>
Diese Vorlage verwendet keine Medien als Vorlage.
=== Benutzer ===
---
==ToDo==
#Kommentieren ^^
schon von haus aus implementiert <nowiki>{{#time: W | TIMESTAMP}}</nowiki>
</noinclude>
{{#vardefine: currentTime |
{{CURRENTTIMESTAMP}}
}}
{{#vardefine: weekday |
{{{Wochentag}}}
}}
{{#vardefine: interval |
{{{Intervall}}}
}}
{{#vardefine: time |
{{#pad: {{#pad: {{#sub: {{{Uhrzeit}}} | 0 | 2 }} | 4 | {{#sub: {{{Uhrzeit}}} | 3 | 2 }} | right }} | 6 | 0 | right }}
}}
{{#vardefine: currentYear |
{{#sub: {{#var:currentTime}} | 0 | 4 }}
}}
{{#vardefine: currentMonth |
{{#sub: {{#var:currentTime}} | 4 | 2 }}
}}
{{#vardefine: isLeapyear |
{{#ifexpr: ({{#var: currentYear}} mod 400) = 0 | 1 |
{{#ifexpr: ({{#var: currentYear}} mod 100) = 0 | 0 |
{{#ifexpr: ({{#var: currentYear}} mod 4) = 0 | 1 | 0 }}
}}
}}
}}
{{#vardefine: daysOfMonth |
{{#switch: {{#var: currentMonth}}
|01 = 31
|02 = {{#ifeq: {{#var: isLeapyear}} | 1 | 29 | 28 }}
|03 = 31
|04 = 30
|05 = 31
|06 = 30
|07 = 31
|08 = 31
|09 = 30
|10 = 31
|11 = 30
|12 = 31
}}
}}
{{#vardefine: firstDayOfCurrentMonth |
{{#time: D |
{{#pad: {{#var: currentYear}} | 14 |
{{#pad: {{#var: currentMonth}} | 10 | 01000000 | right}} |
right
}}
}}
}}
{{#vardefine: firstDesiredWeekday |
{{#switch: {{#var: weekday}}
|Mo = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 1
|Di = 7
|Mi = 6
|Do = 5
|Fr = 4
|Sa = 3
|So = 2
}}
|Di = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 2
|Di = 1
|Mi = 7
|Do = 6
|Fr = 5
|Sa = 4
|So = 3
}}
|Mi = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 3
|Di = 2
|Mi = 1
|Do = 7
|Fr = 6
|Sa = 5
|So = 4
}}
|Do = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 4
|Di = 3
|Mi = 2
|Do = 1
|Fr = 7
|Sa = 6
|So = 5
}}
|Fr = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 5
|Di = 4
|Mi = 3
|Do = 2
|Fr = 1
|Sa = 7
|So = 6
}}
|Sa = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 6
|Di = 5
|Mi = 4
|Do = 3
|Fr = 2
|Sa = 1
|So = 7
}}
|So = {{#switch: {{#var: firstDayOfCurrentMonth}}
|Mo = 7
|Di = 6
|Mi = 5
|Do = 4
|Fr = 3
|Sa = 2
|So = 1
}}
}}
}}
{{#vardefine: nextDatesYear |
{{#ifexpr: ({{#var: currentMonth}} + 1) > 12 |
{{#expr: ({{#var: currentYear}} + 1 )}} |
{{#var: currentYear}}
}}
}}
{{#vardefine: nextMonth |
{{#ifexpr: ({{#var: currentMonth}} + 1) > 12 |
01 |
{{#ifexpr: {{#var: currentMonth}} + 1 > 9 |
{{#expr: {{#var: currentMonth}} + 1 }} |
{{#pad: {{#expr: {{#var: currentMonth}} + 1 }} | 2 | 0 | left }}
}}
}}
}}
{{#vardefine: firstDayOfNextMonth |
{{#time: D |
{{#pad: {{#var: nextDatesYear}} | 14 |
{{#pad: {{#var: nextMonth}} | 10 | 01000000 | right}} |
right
}}
}}
}}
{{#vardefine: daysOfNextMonth |
{{#switch: {{#var: nextMonth}}
|01 = 31
|02 = {{#ifeq: {{#var: isLeapyear}} | 1 | 29 | 28 }}
|03 = 31
|04 = 30
|05 = 31
|06 = 30
|07 = 31
|08 = 31
|09 = 30
|10 = 31
|11 = 30
|12 = 31
}}
}}
{{#vardefine: firstDesiredWeekdayNextMonth |
{{#switch: {{#var: weekday}}
|Mo = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 1
|Di = 7
|Mi = 6
|Do = 5
|Fr = 4
|Sa = 3
|So = 2
}}
|Di = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 2
|Di = 1
|Mi = 7
|Do = 6
|Fr = 5
|Sa = 4
|So = 3
}}
|Mi = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 3
|Di = 2
|Mi = 1
|Do = 7
|Fr = 6
|Sa = 5
|So = 4
}}
|Do = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 4
|Di = 3
|Mi = 2
|Do = 1
|Fr = 7
|Sa = 6
|So = 5
}}
|Fr = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 5
|Di = 4
|Mi = 3
|Do = 2
|Fr = 1
|Sa = 7
|So = 6
}}
|Sa = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 6
|Di = 5
|Mi = 4
|Do = 3
|Fr = 2
|Sa = 1
|So = 7
}}
|So = {{#switch: {{#var: firstDayOfNextMonth}}
|Mo = 7
|Di = 6
|Mi = 5
|Do = 4
|Fr = 3
|Sa = 2
|So = 1
}}
}}
}}
{{#vardefine: firstDate
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekday}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: secondDate |
{{#ifexpr: ({{#var: firstDesiredWeekday}} + 7) > 9
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 7}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#pad: {{#expr: {{#var: firstDesiredWeekday}} + 7}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: thirdDate |
{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 14}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fourthDate |
{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 21}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fifthDate |
{{#ifexpr: ({{#var: firstDesiredWeekday}} + 28) <= {{#var: daysOfMonth}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: currentYear}}
| 6
| {{#var: currentMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekday}} + 28}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekdayNextMonth}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: firstDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#var: firstDesiredWeekdayNextMonth}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: secondDateNextMonth |
{{#ifexpr: ({{#var: firstDesiredWeekdayNextMonth}} + 7) > 9
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 7}}
| right
}}
| 14
| {{#var: time}}
| right
}}
|{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#pad: {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 7}} | 2 | 0 | left }}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
}}
{{#vardefine: thirdDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 14}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fourthDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 21}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: fifthDateNextMonth |
{{#pad:
{{#pad:
{{#pad:
{{#var: nextDatesYear}}
| 6
| {{#var: nextMonth}}
| right
}}
| 8
| {{#expr: {{#var: firstDesiredWeekdayNextMonth}} + 28}}
| right
}}
| 14
| {{#var: time}}
| right
}}
}}
{{#vardefine: lastDate |
{{#ifeq: {{#var: currentMonth}} |
{{#sub: {{#var: fifthDate}} |
4 |
2}} |
{{#var: fifthDate}} |
{{#var: fourthDate}}
}}
}}
{{#vardefine: lastDateNextMonth |
{{#ifexpr: ({{#var: daysOfNextMonth}} - {{#sub:
{{#var: fifthDateNextMonth}} |
4 |
2}}) < 0 |
{{#var: fourthDateNextMonth}} |
{{#var: fifthDateNextMonth}}
}}
}}
{{#vardefine: result |
{{#switch: {{#var: interval}}
| 1 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}}
}}
}}
| 2 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#var: firstDateNextMonth}}
}}
}}
| 3 = {{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#var: secondDateNextMonth}}
}}
}}
| 4 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#var: firstDateNextMonth}}
}}
| 5 = {{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#var: secondDateNextMonth}}
}}
| 6 = {{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#var: thirdDateNextMonth}}
}}
| 7 = {{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#var: fourthDateNextMonth}}
}}
| 8 = {{#ifexpr: {{#time: W | {{#var: firstDate}} }} mod 2 = 0 |
{{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: {{#time: W | {{#var: firstDateNextMonth}} }} mod 2 = 0 |
{{#var: firstDateNextMonth}} |
{{#var: secondDateNextMonth}}
}}
}}
}}
}}
| 9 = {{#ifexpr: {{#time: W | {{#var: firstDate}} }} mod 2 != 0 |
{{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}} |
{{#ifexpr: ({{#var: secondDate}} - {{#var:currentTime}}) > 0 |
{{#var: secondDate}} |
{{#ifexpr: ({{#var: fourthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fourthDate}} |
{{#ifexpr: {{#time: W | {{#var: firstDateNextMonth}} }} mod 2 != 0 |
{{#var: firstDateNextMonth}} |
{{#var: secondDateNextMonth}}
}}
}}
}}
}}
| 10 = {{#ifexpr: ({{#var: firstDate}} - {{#var:currentTime}}) > 0 |
{{#var: firstDate}} |
{{#ifexpr: ({{#var: thirdDate}} - {{#var:currentTime}}) > 0 |
{{#var: thirdDate}} |
{{#ifexpr: ({{#var: fifthDate}} - {{#var:currentTime}}) > 0 |
{{#var: fifthDate}} |
{{#var: firstDateNextMonth}}
}}
}}
}}
| 11 = {{#ifexpr: ({{#var: lastDate}} - {{#var:currentTime}}) > 0 |
{{#var: lastDate}} |
{{#var: lastDateNextMonth}}
}}
| 13 = {{#ifexpr:{{LOCALMONTH}}=12 AND {{LOCALDAY}}>{{{Tag|{{{1|1}}}}}}|{{#expr:{{LOCALYEAR}}+1}}01|{{LOCALYEAR}}{{#ifexpr:{{LOCALDAY}}>{{{Tag|{{{1|1}}}}}}|{{#ifexpr:{{LOCALMONTH}}+1<10|0}}{{#expr:{{LOCALMONTH}}+1}}|{{LOCALMONTH}}}}}}{{#ifexpr:{{{Tag|{{{1|1}}}}}}<10|0|}}{{{Tag|{{{1|1}}}}}}{{#var: time}}
}}
}}
{{#var: result}}
</includeonly><noinclude>__NOTOC__
----
Diese Vorlage generiert automatisch einen Timestamp anhand der Vorgaben Wochentag, intervall und Uhrzeit.<br>
Die Ausgabe erfolgt im Format YYYYMMDDhhmmss, bspw. {{CURRENTTIMESTAMP}} für jetzt(bzw. vor zwei stunden, da das wiki eine andere Lokalzeit hat).
=== Benutzung ===
Erstellt eine eigene Vorlage für euren Stammtisch, die folgendes enthält:
<pre>
{{Vorlage:Nächster Stammtisch
| Wochentag = Mo
| Intervall = 1
| Uhrzeit = 19:45
}}
</pre>
Diese Vorlage erzeugt beim Aufruf einen Timestamp entsprechend dem gewünschten Intervall. Hier der Schlüssel für die Intervalle (einfach die gewünschte Zahl verwenden):
<pre>
1 : jede Woche
2 : jeden 1. und 3.
3 : jeden 2. und 4.
4 : jeden 1.
5 : jeden 2.
6 : jeden 3.
7 : jeden 4.
8 : jede gerade Woche (nach ISO 8601 mit Montag beginnend)
9 : jede ungerade Woche (nach ISO 8601 mit Montag beginnend)
10: jeden 1., 3. und 5.
11: jeden Letzten des Monats
13: jedes bestimmte Monatsdatum, beispielsweise jeder 5. (Anzugeben mit dem Parameter Tag)
</pre>
Diesen Timestamp könnt ihr dann auf eurer Seite mit der funktion
<pre>
{{#time: ZEITFORMAT | TIMESTAMP}}
</pre>
in ein lesbares Datum umwandeln.
ZEITFORMAT entsprich dabei einem Formatierungsstring, mehr Infos zur Formatierung gibt es [http://de.wikipedia.org/wiki/Hilfe:Vorlagenprogrammierung#Funktion_time hier]<br>
Ein Beispiel wäre:
<pre>
{{#time: l, \d\e\n d.m.Y \u\m H:i \U\h\r | 20100515184500 }}
</pre>
Das Resultat wäre:
<pre>
Samstag, den 15.05.2010 um 18:45 Uhr
</pre>
Anstelle von TIMESTAMP könnt ihr entweder manuell einen Timestamp eintragen, wie im Beispiel, oder für regelmäßige Termine gebt ihr hier eure oben erstellte Vorlage an.
=== Ersteller ===
Diese Vorlage wurde von [[http://wiki.piratenpartei.de/wiki/Benutzer:Isabaellchen|Isabaellchen]] erstellt.
=== Bezüge ===
Diese Vorlage verwendet keine Vorlage<br/>
Diese Vorlage verwendet keine Medien als Vorlage.
=== Benutzer ===
---
==ToDo==
#Kommentieren ^^
schon von haus aus implementiert <nowiki>{{#time: W | TIMESTAMP}}</nowiki>
</noinclude>