Difference between revisions of "Template:Date"

From Timelines
Jump to: navigation, search
(english format)
(Moved sandbox live to fix wrong output when substituted)
 
(58 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq:{{#time:Y-m-d|{{{1}}}}}|{{{1}}}|
+
{{{{{|safesubst:}}}#switch:none
{{#iferror:{{ #time:Y|{{{1}}} }}
+
|{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
|{{{1|}}}
+
|{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#expr: {{{1|}}}+0 }}
|{{ #ifeq:{{#time:U|{{{1}}} }}|0
+
    |<noinclude><!--not a pure number--></noinclude>
  |{{{1|}}}
+
    |{{{{{|safesubst:}}}#ifexpr: {{{1|}}}+0 > 10000000000000
   |{{ #ifeq:{{{2| }}}|n
+
      |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
  |{{ #time:j F Y|{{{1}}} }}  
+
      |{{{{{|safesubst:}}}#ifeq: {{{{{|safesubst:}}}#expr:{{{1|}}}+0}} | {{{1|}}}
  |[[{{ #time:j F|{{{1}}} }}]] [[{{ #time:Y|{{{1}}} }}]]}} }} }}<span style="display:none">(<span class="bday">{{{1}}}</span>)</span>
+
          | none <noinclude><!-- pure number eg 123.456 --></noinclude>
|{{{1}}}}}</includeonly><noinclude>
+
          | <noinclude><!-- assume yy-mm-dd --></noinclude>
 
+
        }}
==Usage==
+
    }}
*Parameter 1 er dato oppgitt på [[ISO 8601]]-formatet ''YYYY-MM-DD'' (eller annet format [[:meta:ParserFunctions#.23time:|#time]]-funksjonen takler). Malen returnerer datoen på formen ''D. MMMM YYYY'' som er [[de facto]]-standard på norskspråklig Wikipedia, se [[Wikipedia:Stilmanual#Datoer]] (og anbefalt av [http://www.sprakrad.no/Raad/Skriveregler_og_grammatikk/Dato/#dato Språkrådet]).
+
   }}
*Parameter 2 settes til n om du ikke ønsker å wikifisere datoen.
+
|{{{{{|safesubst:}}}#switch:  {{{{{|safesubst:}}}lc:{{{2|}}}}} | none | asis | link | lnone =none }}
 
+
|{{{{{|safesubst:}}}#ifexpr:  {{{{{|safesubst:}}}#time:Y|{{{1|}}} }} < 1000 | none }}
{{evd|ISOtodmymdy|2007-01-24}}
+
|{{{{{|safesubst:}}}#switch:  {{{{{|safesubst:}}}#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
 
+
|= {{{{{|safesubst:}}}#if:{{{1|}}}
{{evd|ISOtodmymdy|2006-05-04|n}}
+
      |{{{{{|safesubst:}}}#switch:{{{2}}}
 
+
        |link|lnone|l=[[{{{1}}}]]
{{evd|ISOtodmymdy|2006-5-4|n}}
+
        |{{{1}}}
 
+
      }}
{{evd|ISOtodmymdy|2006-5-04|n}}
+
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
 
+
|<noinclude><!-- continue with formatting --></noinclude>
{{evd|ISOtodmymdy|2006-05-4|n}}
+
  {{{{{|safesubst:}}}#ifeq:<noinclude><!--
 
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2008}}<noinclude><!--
{{evd|ISOtodmymdy|May 4th, 2006|n}}
+
    --></noinclude>{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
 
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2004}}
===Datostrenger som #time-.funksjonen ikke klarer å tolke returnerer bare strengen ===
+
  |20082004
+
  |<noinclude><!-- no year --></noinclude>
{{evd|ISOtodmymdy|23007-031-24}}
+
    {{{{{|safesubst:}}}#ifeq:{{{{{|safesubst:}}}#time:d|{{{1}}} 2036}}|{{{{{|safesubst:}}}#time:d|{{{1}}} }}
 
+
    |<noinclude><!-- month+day --></noinclude>{{{{{|safesubst:}}}#time:
{{evd|ISOtodmymdy|1 desember 2008}}
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
+
      | lmdy | liso | lymd      = [[:F j]]
{{evd|ISOtodmymdy|[[1. desember]] [[2008]]}}
+
      | mdy  | iso  | ymd      = F j
 
+
      | ldmy | l                = [[:j F]]
{{evd|ISOtodmymdy|1 desember 2006}}
+
      | #default                = j F
 
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
{{evd|ISOtodmymdy|[[1. desember]] [[2006]]}}
+
    |<noinclude><!-- month only --></noinclude>{{{{{|safesubst:}}}#time:
 
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
+
      | lmdy | liso | lymd
{{evd|ISOtodmymdy|24. Juni, 2006}} BUG
+
      | ldmy | l                = [[F]]
 
+
      | #default                = F
{{evd|ISOtodmymdy|24. juni 2006|n}} BUG
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
 
+
    }}
;utenfor [[:meta:ParserFunctions#.23time:|#time]]-funksjonens grenseverdier
+
  |<noinclude><!-- with year--></noinclude>
 
+
    {{{{{|safesubst:}}}#if: {{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2 {{{1|}}}}}|*D*|{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2000 {{{1|}}}}}|*D*| }}}}
 
+
    |<noinclude><!-- day+month+year --></noinclude>{{{{{|safesubst:}}}#time:
{{evd|ISOtodmymdy|1901-12-13}}, <nowiki>{{#time:c|1901-12-13}}</nowiki> gir {{#time:c|1901-12-13}}
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
+
      | lmdy                    = [[:F j]], [[Y]]
{{evd|ISOtodmymdy|1901-12-14}}, <nowiki>{{#time:c|1901-12-14}}</nowiki> gir {{#time:c|1901-12-14}} (#time er riv ruskende gal, justert for i mal for alle disse tilfellene)
+
      | mdy                    = F j, Y
 
+
      | liso                    = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
{{evd|ISOtodmymdy|1970-01-01}}, <nowiki>{{#time:c|1970-01-01}}</nowiki> gir {{#time:c|1970-01-01}}
+
      | iso                    = Y-m-d
 
+
      | lymd                    = [[Y]] [[:F j]]
{{evd|ISOtodmymdy|1970-01-02}} (riktig, første dato innenfor), <nowiki>{{#time:c|1970-01-02}}</nowiki> gir {{#time:c|1970-01-02}}
+
      | ymd                    = Y F j
 
+
      | ldmy | l                = [[:j F]] [[Y]]
{{evd|ISOtodmymdy|2038-01-19}} (riktig, siste dato innenfor), <nowiki>{{#time:c|2038-01-19}}</nowiki> gir {{#time:c|2038-01-19}}
+
      | #default                = j F Y
 
+
      }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
{{evd|ISOtodmymdy|2038-01-20}}, <nowiki>{{#time:c|2038-01-20}}</nowiki> gir {{#time:c|2038-01-20}}
+
    |<noinclude><!-- month+year --></noinclude>{{{{{|safesubst:}}}#time:
 
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
[[Category:Date templates]]
+
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
 
+
      | #default                = F Y
[[no:Mal:ISOtilNorskdato]]
+
      }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
 +
    }}
 +
  }}   
 +
}}<noinclude>
 +
{{documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 08:05, 12 September 2015

20 December 2024

Template documentation[create]