Vorlage:FormatDate: Unterschied zwischen den Versionen
Aus Hist. Verein Herne / Wanne-Eickel
Inhalt gelöscht Inhalt hinzugefügt
→Beispiele: als Tabelle |
K {{Dokumentation}} |
||
| Zeile 1: | Zeile 1: | ||
<noinclude>{{Dokumentation}} |
|||
<includeonly><!-- |
|||
| ⚫ | |||
Kleine Tricks zur Ermittlung der Komponenten: |
|||
d = {{#expr:({{{1}}})-({{{1}}}*2)}} z.B. {{#expr:(2000-12-31)-(2000-12-31*2)}} |
|||
m = {{#expr:-(0*{{{1}}}*0)}} z.B. {{#expr:-(0*2000-12-31*0)}} |
|||
y = {{#expr:(2*{{{1}}})-({{{1}}})}} z.B. {{#expr:(2*2000-12-31)-(2000-12-31)}} |
|||
| ⚫ | |||
| 1=Jan. |
| 1=Jan. |
||
| 2=Feb. |
| 2=Feb. |
||
| Zeile 19: | Zeile 13: | ||
|11=Nov. |
|11=Nov. |
||
|12=Dez. |
|12=Dez. |
||
|#default=???}} }}{{#expr:(2*{{{1}}})-({{{1}}})}}</includeonly |
|#default=???}} }}{{#expr:(2*{{{1}}})-({{{1}}})}}</includeonly> |
||
Die Vorlage '''FormatDate''' formatiert ein in Anlehnung an [[ISO 8601]] angegebenes Datum mit abgekürzten deutschen Monatsnamen zur Verwendung in Listen oder Infoboxen. Im Gegensatz zur Parser-Funktion [[Hilfe:Vorlagenprogrammierung#Funktion time|#time:]] kann sie auch Daten vor dem 1. Januar 1970 und nach dem 9. Januar 2038 verarbeiten. Außerdem kann durch Angabe einer <code>0</code> für Monat und Tag eine Ausgabe ohne Monats-/Tagangabe erzielt werden. |
|||
== Aufruf == |
|||
<code><nowiki>{{FormatDate|Datum}}</nowiki></code> |
|||
Dabei muss <code>Datum</code> in der Form "jjjj-mm-tt" oder "jjjj-m-t" angegeben werden, also z.B. "1881-11-03" für den 3. November 1881. Die Angabe in der Form "jjjj-mm-0" oder "jjjj-mm-00" unterdrückt die Angabe des Tages für Datumsangaben, die nur monatsgenau sind. Die Angabe in der Form "jjjj-0-0" oder "jjjj-00-00" gibt nur das Jahr aus. |
|||
== Beispiele == |
|||
{| class="prettytable" |
|||
|- class="hintergrundfarbe6" |
|||
!Vorlage-Syntax!!Dargestelltes Ergebnis |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|1234-01-01}}</nowiki></code> || {{FormatDate|1234-01-01}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|1234-2-28}}</nowiki></code> || {{FormatDate|1234-2-28}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|1881-3-1}}</nowiki></code> || {{FormatDate|1881-3-1}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|1881-04-1}}</nowiki></code> || {{FormatDate|1881-04-1}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-05-30}}</nowiki></code> || {{FormatDate|2000-05-30}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-06-29}}</nowiki></code> || {{FormatDate|2000-06-29}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-07-28}}</nowiki></code> || {{FormatDate|2000-07-28}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-08-27}}</nowiki></code> || {{FormatDate|2000-08-27}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-9-0}}</nowiki></code> || {{FormatDate|2000-9-0}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-10-0}}</nowiki></code> || {{FormatDate|2000-10-0}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-11-00}}</nowiki></code> || {{FormatDate|2000-11-00}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-12-00}}</nowiki></code> || {{FormatDate|2000-12-00}} |
|||
|--- |
|||
| <code><nowiki>{{FormatDate|2000-0-0}}</nowiki></code> || {{FormatDate|2000-0-0}} |
|||
|} |
|||
== Siehe auch == |
|||
* [[Vorlage:FormatNum]], zur länderspezifischen Formatierung von Zahlen |
|||
[[Kategorie:Vorlage:Datumsberechnung|{{PAGENAME}}]] |
|||
</noinclude> |
|||
