Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Birth date and age: Difference between revisions

Template page
Blossom (talk | contribs)
No edit summary
Blossom (talk | contribs)
No edit summary
Line 3: Line 3:
</noinclude>
</noinclude>
<includeonly>
<includeonly>
{{#if: {{{1|}}} <!-- Check if the first parameter (birthdate) is provided -->
{{#if:{{{1|}}}|
  | {{#time:j F Y|{{{1}}}}} <!-- Format the birth date (e.g., 21 September 1934) -->
    {{#time:j F Y|{{{1}}}}}
    ({{#expr: {{CURRENTYEAR}} - {{#time:Y|{{{1}}}}} <!-- Calculate age -->
| ''No date provided''
      {{#ifexpr: {{CURRENTMONTH}} < {{#time:n|{{{1}}}}} or ({{CURRENTMONTH}} = {{#time:n|{{{1}}}}} and {{CURRENTDAY}} < {{#time:j|{{{1}}}}})
        | -1 <!-- Subtract 1 year if the current date is before the birthdate -->
        | 0
      }}
    }}})
  | ''No date provided'' <!-- Default text if no date is provided -->
}}
}}
</includeonly>
</includeonly>

Revision as of 16:52, 10 December 2024

Your wiki got a version of Template:Documentation that is only relevant to Templates Wiki! Click here to revert it. For a documentation template you can use on your wiki, see Template:Documentation (copy) on Templates Wiki.
Template information, documentation, and installation instructions.
Expand the below text for usage and other information.

Template Documentation:
Note: The template above might be broken without the parameters; this is normal.
View, edit, or check the history of this documentation. (How does this work?)
Editors can experiment with this template's sandbox and testcases.
Note
Date defaults to Jan 1, 1990 (1 Jan 1990 or 1990/1/1).
Dependencies
Parameters
  • 1 = year #
    • year = alternate year #
  • 2 = month #
    • month = alternate month #
  • 3 = day #
    • day = alternate day #
  • df=yes or df=1 show date in day number first (DD Month YYYY) format
Examples
  • {{Birth date and age|year=1929|month=1|day=15}}

No date provided

  • {{Birth date and age|1976|7|4}}

15 July 1976

  • {{Birth date and age|1929|1|15|df=yes}}
15 July 1929

Installation Instructions
Export this template, then import to install it.
Use edit summary: Copied from [[w:c:templates:Template:Birth date and age]] to properly attribute this template's editors.
There is no additional installation instructions for this template. If there is any, you may create it at Template:Birth date and age/install.