Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Search
Editing
Template:Year/doc
From MEpedia, a crowd-sourced encyclopedia of ME and CFS science and history
Namespaces
Template
Discussion
More
More
Page actions
Read
Edit source
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{csdoc|lua}} ==New code: more time formats accepted == If last "word" is 4 digits then just use that. <pre> <!--ends in 4 digits --> {{#ifeq:{{str len|{{digits|{{last word|{{{1|}}}}}}}}}|4 |{{digits|{{last word|{{{1|}}}}}}} |false}}<!--doesnt end in 4 digits --> </pre> {{#time: F d"," Y}} β 2019 {{#time: M d"," Y}} β 2019 {{#time: M Y}} β 2019 == Usage == {{Tlx|year|{{var|string formatted as a valid date}}}} <nowiki>{{year|}}</nowiki> - {{year|}} <nowiki>{{year|1999}}</nowiki> - {{year|1999}} <nowiki>{{year|1999-12-12}}</nowiki> - {{year|1999-12-12}} <nowiki>{{year|January 1999}}</nowiki> - {{year|January 1999}} <nowiki>{{year|15 January 1999}}</nowiki> - {{year|15 January 1999}} <nowiki>{{year|January 1, 1999}}</nowiki> - {{year|January 1, 1999}} <nowiki>{{year|1-2-1990}}</nowiki> - {{year|1-2-1990}} <nowiki>{{year|1/2/1990}}</nowiki> - {{year|1/2/1990}} <nowiki>{{year|2239-10-23}}</nowiki> - {{year|2239-10-23}} <nowiki>{{year|October 10, 2019}}</nowiki> {{year|October 10, 2019}} <nowiki>{{year|Oct 2019}}</nowiki> {{year|Oct 2019}} <nowiki>{{year|Oct 10, 2019}}</nowiki> {{year|Oct 10, 2019}} Reports "Error" without a reason if given bad input: <nowiki>{{year|1-14-1990}} </nowiki>{{year|1-14-1990}}<br />Reason for the error: there are not 14 months. <nowiki>{{year|61 January 1999}}</nowiki> {{year|61 January 1999}}<br />Reason for the error: no month has 61 days. <nowiki>{{year|1 MyMonth 1999}} </nowiki> {{year|1 MyMonth 1999}}<br />Reason for the error: there is no such month name. <nowiki>{{year|Some text which is not a date}} </nowiki>{{year|some text which is not a date}}<br />Reason for the error: no date information to parse. If used with a year range, it returns only the first match: * <nowiki>{{year|1999-2001}} </nowiki>{{year|1999-2001}} This presently only works when the year range is specified with a hyphen -; if correctly given with an en dash -; which looks very similar, it reports an error (handling ranges is not the template's function). If used without input, it simply outputs the current year: *<nowiki>{{year}} </nowiki>{{year}} *<nowiki>{{year|}} </nowiki>{{year|}} It can be cleanly substituted for this purpose. If fed invalid data when substituted, it produces a larger, red error. If used when the value is already a year rather than a full date, it simply outputs the year: *<nowiki>{{year|2018}} </nowiki>{{year|2018}} {{:Template:Date/doc/See_also}} * {{tlx|date}} β outputs the current date in various parameter-controlled formats * {{tlx|DATE}} β a subst-only convenience template used inside cleanup/dispute templates; <code><nowiki>|{{subst:DATE}}</nowiki></code> produces: <code>{{!}}date=December 2018</code> * [[:Category:date and time templates]] β numerous date computing, formatting, annotating, and navigation templates {{:Template:Date/doc/See_also}} <includeonly> <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> [[Category:Date and time templates]] </includeonly>
Summary:
Please make sure your edits are consistent with
MEpedia's guidelines
.
By saving changes, you agree to the
Terms of use
, and you irrevocably agree to release your contribution under the
CC BY-SA 3.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Citation Style documentation
(
edit
)
Template:Citation Style documentation/lua
(
edit
)
Template:Csdoc
(
edit
)
Template:Date/doc/See also
(
edit
)
Template:Digits
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Last word
(
edit
)
Template:Lua
(
edit
)
Template:Mbox
(
edit
)
Template:Str len
(
edit
)
Template:Strong
(
edit
)
Template:T1
(
edit
)
Template:Template link expanded
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tlx
(
edit
)
Template:Var
(
edit
)
Template:Year
(
edit
)
Module:Arguments
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:No globals
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Yesno
(
edit
)
Navigation
Navigation
Skip to content
Main page
Browse
Become an editor
Random page
Popular pages
Abbreviations
Glossary
About MEpedia
Links for editors
Contents
Guidelines
Recent changes
Pages in need
Search
Help
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs