Difference between revisions of "Template:Date"

From "PTTLink Wiki"
Jump to navigation Jump to search
m (1 revision imported)
m (1 revision imported)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<!--  
+
{{safesubst:<noinclude/>#switch:none
{{{1|}}} = year: {{#expr: {{{1|}}} }} will strip leading zeros if any
+
  |{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
{{{2|}}} = month: input to {{I18n month}}
+
|{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#expr: {{{1|}}}+0 }}
{{{3|}}} = day: {{#expr: {{{3}}} }} will strip leading zeros if any
+
    |<noinclude><!--not a pure number--></noinclude>
{{{4|}}} = language code
+
    |{{safesubst:<noinclude/>#ifexpr: {{{1|}}}+0 > 10000000000000
 
+
      |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
--><onlyinclude>{{#if:{{{1|}}}{{{2|}}}{{{3|}}}|
+
      |{{safesubst:<noinclude/>#ifeq: {{safesubst:<noinclude/>#expr:{{{1|}}}+0}} | {{{1|}}}
 
+
          | none <noinclude><!-- pure number eg 123.456 --></noinclude>
{{#ifexpr:{{#if:{{{1|}}}|1|0}}or({{#if:{{{2|}}}|1|0}}and{{#if:{{{3|}}}|1|0}})|
+
          | <noinclude><!-- assume yy-mm-dd --></noinclude>
<time datetime="{{{1|}}}{{#if:{{{2|}}}
+
        }}
|{{#if:{{{1|}}}|-}}{{{2}}}{{#if:{{{3|}}}|-{{{3}}}}}}}">
+
    }}
}}{{#switch: {{#if: {{{4|}}} | {{{4}}} | {{pagelang2}} }}
+
  }}
 
+
|{{safesubst:<noinclude/>#switch:  {{safesubst:<noinclude/>lc:{{{2|}}}}} | none | asis | link | lnone =none }}
<!-- Spanish-like group (day de month de year) -->
+
|{{safesubst:<noinclude/>#ifexpr:  {{safesubst:<noinclude/>#time:Y|{{{1|}}} }} < 1000 | none }}
|es |gl |pt
+
|{{safesubst:<noinclude/>#switch:  {{safesubst:<noinclude/>#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
        ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} de}} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|{{{4|}}}}} de }} {{{1|}}}
+
|= {{safesubst:<noinclude/>#if:{{{1|}}}
 
+
      |{{safesubst:<noinclude/>#switch:{{{2}}}
<!-- Slavic group 1: if YYYY-MM-DD than month is in gen form, if YYYY-MM than month in basic form -->
+
        |link|lnone|l=[[{{{1}}}]]
|uk |be |be-tarask |el
+
        |{{{1}}}
        ={{#if: {{{3|}}} | {{#expr:{{{3}}}}} {{I18n month|{{{2|}}}|{{{4|}}}|form=gen}} | {{I18n month|{{{2|}}}|{{{4|}}}}} }} {{{1|}}}
+
      }}
 
+
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
<!-- Slavic group 2: if YYYY-MM-DD than month is in gen form, if YYYY-MM than month form is controlled by {{{form}}} -->
+
|<noinclude><!-- continue with formatting --></noinclude>
|pl |ru  ={{#if: {{{3|}}} | {{#expr:{{{3}}}}} {{I18n month|{{{2|}}}|{{{4|}}}|form=gen}} | {{I18n month|{{{2|}}}|{{{4|}}}|form={{{form|}}} }} }} {{{1|}}}
+
  {{safesubst:<noinclude/>#ifeq:<noinclude><!--
 
+
    --></noinclude>{{safesubst:<noinclude/>#time:Y|{{{1}}} 2008}}<noinclude><!--
<!-- Finnish language: YYYY-MM-DD month in Partitive form, if YYYY-MM than month form is controlled by {{{form}}} -->
+
    --></noinclude>{{safesubst:<noinclude/>#iferror: {{safesubst:<noinclude/>#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
|fi      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}. {{I18n month|{{{2}}}|fi|form=ptv}} | {{I18n month|{{{2|}}}|fi|form={{{form|}}} }} }} {{{1|}}}
+
    --></noinclude>{{safesubst:<noinclude/>#time:Y|{{{1}}} 2004}}
 
+
  |20082004
<!-- German-like group (day. month year) -->
+
  |<noinclude><!-- no year --></noinclude>
|da |de |de-formal |de-at |de-ch |bar |et |nds |nn |no
+
    {{safesubst:<noinclude/>#ifeq:{{safesubst:<noinclude/>#time:d|{{{1}}} 2036}}|{{safesubst:<noinclude/>#time:d|{{{1}}} }}
        ={{#if: {{{3|}}} | {{#expr:{{{3}}}}}.}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{{1|}}}
+
    |<noinclude><!-- month+day --></noinclude>{{safesubst:<noinclude/>#time:
 
+
      {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
<!-- South Asia group -->
+
      | lmdy | liso | lymd      = [[:F j]]
|fa |hi |pa
+
      | mdy  | iso  | ymd      = F j
        ={{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|{{{4|}}}|sep=1}} }} {{I18n month|{{{2|}}}|{{{4|}}}}} {{formatnum|{{{1|}}}|{{{4|}}}|sep=1}}
+
      | ldmy | l                = [[:j F]]
 
+
      | #default                = j F
<!-- Chinese-like group (year年 month day日) -->
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
|zh |zh-hans |zh-hant |zh-cn |zh-tw |ja
+
    |<noinclude><!-- month only --></noinclude>{{safesubst:<noinclude/>#time:
        ={{#if: {{{1|}}} | {{#expr:{{{1|}}}}}年}}{{I18n month|{{{2|}}}|{{{4|}}}}}{{#if: {{{3|}}} |{{#expr:{{{3|}}}}}}}
+
      {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
+
      | lmdy | liso | lymd
<!-- individual languages in alphabetic order using syntax different than default or other groups below -->
+
      | ldmy | l                = [[F]]
|bn      ={{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|bn|sep=1}} }} {{I18n month|{{{2|}}}|bn}} {{formatnum|{{{1|}}}|bn|sep=1}}
+
      | #default                = F
|bpy    ={{I18n month|{{{2|}}}|bpy}} {{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|bpy|sep=1}} }}, মারি {{formatnum|{{{1|}}}|bpy|sep=1}}
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
|cs      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}. {{I18n month|{{{2|}}}|cs|form={{#if:{{{form|}}}|{{{form}}}|gen}}}} | {{I18n month|{{{2|}}}|cs|form={{{form|}}}}} }} {{{1|}}}
+
    }}
|eo      ={{#if: {{{3|}}} | la {{#expr: {{{3}}} }}-a de}} {{I18n month|{{{2|}}}|eo}} {{{1|}}}
+
  |<noinclude><!-- with year--></noinclude>
|fr      ={{#if: {{{3|}}} | {{#expr: {{{3}}}}}{{#ifeq: {{{3|}}} | 1 |<sup>er</sup>}} }} {{I18n month|{{{2|}}}|fr}} {{{1|}}}
+
    {{safesubst:<noinclude/>#if: {{safesubst:<noinclude/>#iferror:{{safesubst:<noinclude/>#time:j|2 {{{1|}}}}}|*D*|{{safesubst:<noinclude/>#iferror:{{safesubst:<noinclude/>#time:j|2000 {{{1|}}}}}|*D*| }}}}
|ga      ={{#if: {{{3|}}} | {{#expr: {{{3}}}}}{{#ifeq: {{{3|}}} | 1 |<sup>ú</sup>}} }} {{I18n month|{{{2|}}}|ga}} {{{1|}}}
+
    |<noinclude><!-- day+month+year --></noinclude>{{safesubst:<noinclude/>#time:
|hr      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|hr}} {{#if: {{{1|}}} | {{#expr: {{{1|}}} }}.}}
+
      {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
|hu      ={{#if: {{{1|}}} | {{#expr: {{{1}}} }}.}} {{I18n month|{{{2|}}}|hu}} {{#if: {{{3|}}} | {{#expr: {{{3}}} }}{{#if: {{{form|}}} | | . }} }}
+
      | lmdy                    = [[:F j]], [[Y]]
|ia      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} de}} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|ia}} }} {{{1|}}}
+
      | mdy                    = F j, Y
|kn      ={{I18n month|{{{2|}}}|kn}} {{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|kn|sep=1}} }}, {{formatnum|{{{1|}}}|kn|sep=1}}
+
      | liso                    = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
|ko      ={{#if: {{{1|}}} | {{#expr: {{{1|}}} }}년}} {{I18n month|{{{2|}}}|ko}} {{#if: {{{3|}}} |{{#expr:{{{3|}}}}}일}}
+
      | iso                    = Y-m-d
|lt      ={{#if: {{{1|}}} | {{{1|}}} m. }} {{I18n month|{{{2|}}}|lt}} {{#if: {{{3|}}} | {{#expr: {{{3}}} }} d.}}
+
      | lymd                    = [[Y]] [[:F j]]
|lv      ={{#if: {{{1|}}} | {{#expr:{{{1|}}}}}. gada }} {{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|lv}}
+
      | ymd                    = Y F j
|mk      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{I18n month|{{{2|}}}|mk}} {{#expr: {{{1|}}} }}
+
      | ldmy | l                = [[:j F]] [[Y]]
|ml      ={{#if: {{{1|}}} | {{#expr:{{{3|}}} }}  {{I18n month|{{{2|}}}|ml}}  {{#expr:{{{1|}}} }}|{{I18n month|{{{2|}}}|ml}} {{#expr:{{{3|}}} }} }}
+
      | #default                = j F Y
|mr      ={{I18n month|{{{2|}}}|mr}} {{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|mr|sep=1}} }}, इ.स. {{formatnum|{{{1|}}}|mr|sep=1}}
+
      }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
|new    ={{I18n month|{{{2|}}}|new}} {{#if: {{{3|}}} | {{formatnum|{{#expr: {{{3}}} }}|new|sep=1}} }}, ई सं {{formatnum|{{{1|}}}|new|sep=1}}
+
    |<noinclude><!-- month+year --></noinclude>{{safesubst:<noinclude/>#time:
|oc      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{#if: {{{2|}}} | {{I18n month|{{{2|}}}|oc}} de }} {{{1|}}}
+
      {{safesubst:<noinclude/>#switch: {{safesubst:<noinclude/>lc: {{safesubst:<noinclude/>#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
|pt-br  ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} de }} {{#if: {{{2|}}} | {{lc:{{I18n month|{{{2|}}}|pt}}}} de }} {{{1|}}}
+
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
|sl      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|sl|form={{{form|}}} }} {{{1|}}}
+
      | #default               = F Y
|sr      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}.}} {{I18n month|{{{2|}}}|sr|}} {{#expr: {{{1|}}} }}.
+
      }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
|sv      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }}}} {{I18n month|{{{2|}}}|sv|}} {{#expr: {{{1|}}} }}
+
    }}
|th      ={{#if: {{{3|}}} | {{#expr: {{{3}}} }} }} {{I18n month|{{{2|}}}|th}} {{#if: {{{1|}}} | {{#ifexpr: {{{1}}} <= 1940 | {{#if: {{{2|}}} | {{#ifexpr: {{{2|}}} < 4 | พ.ศ. {{#expr: {{{1}}} + 542 }} | พ.ศ. {{#expr: {{{1}}} + 543 }} }} | {{#expr: {{{1}}} + 542 }} หรือ {{#expr: {{{1}}} + 543 }} }} | พ.ศ. {{#expr: {{{1}}} + 543 }} }} }}
+
  }}  
 
+
}}<noinclude>
<!-- default (English) group (day month year) -->
+
{{documentation}}
|#default={{#expr:{{{3|}}}}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{{1|}}}
+
</noinclude>
 
 
}}{{#if:{{{1|}}}|</time>}}{{#if:{{{1|}}}|
 
<span style="display:none">(<span class="dtstart">{{padleft:{{{1}}}|4|0}}{{#if: {{{2|}}}|-{{padleft:{{{2}}}|2|0}}}}{{#if: {{{3|}}}|-{{padleft:{{{3}}}|2|0}}}}</span>)</span>
 
}}}}</onlyinclude>
 
{{Documentation}}
 
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
 

Latest revision as of 17:46, 21 January 2022

6 May 2024

Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Date/doc.

Examples

  • {{date|2016|06|10}} → 2016
  • {{date|2016|06}} → 2016
  • {{date|2016|06||ja}} → 2016
  • {{date|2016|06||bn}} → 2016
  • {{date||06|10}} → 6 May
  • {{date||06}} → 6 May