This site is supported by donations to The OEIS Foundation.
Template:Millennium
From OeisWiki
The following documentation is located at Template:Millennium/doc. [<Edit> Template:Millennium/doc]
[⧼Purge⧽ Template:Millennium]
[⧼Purge⧽ Template:Millennium]
The {{millennium}} date and time template returns the millennium in which the given year belongs, where the year defaults to local year of OEIS Wiki server. There was no year 0, since the ancient Greeks or Romans had no concept of zero. Thus the years 1 to 1000 belong to millennium 1 (the 1st Millennium AD,) ..., the years 19001 to 20000 belong to millennium 20 (the 20th Millennium AD.) Conversely, the years -1 to -1000 belong to millennium -1 (the 1st Millennium BC,) ..., the years -19001 to -20000 belong to millennium -20 (the 20th Millennium BC.)
Contents
Usage
- {{millennium|year as a nonzero unformatted integer}}
or
- {{millennium}} where year defaults to local year of OEIS Wiki server
Examples
Examples with valid input
code result {{millennium}} 3 {{millennium|1}} 1 {{millennium|999}} 1 {{millennium|1000}} 1 {{millennium|1001}} 2 {{millennium|1999}} 2 {{millennium|2000}} 2 {{millennium|2001}} 3 {{millennium|199999}} 200 {{millennium|200000}} 200 {{millennium|200001}} 201 {{millennium|-1}} −1 {{millennium|-999}} −1 {{millennium|-1000}} −1 {{millennium|-1001}} −2 {{millennium|-1999}} −2 {{millennium|-2000}} −2 {{millennium|-2001}} −3 {{millennium|-199999}} −200 {{millennium|-200000}} −200 {{millennium|-200001}} −201
Examples with invalid input
code result {{millennium|0}} Millennium error: There was no year 0 (the ancient Greeks or Romans had no concept of zero) {{millennium|800.5}} Millennium error: Year must be a nonzero unformatted integer {{millennium|2,000}} Millennium error: Year must be a nonzero unformatted integer {{millennium|two thousand}} Millennium error: Year must be a nonzero unformatted integer {{millennium|2000 ans}} Millennium error: Year must be a nonzero unformatted integer {{millennium|year 2000}} Millennium error: Year must be a nonzero unformatted integer
Code
{{ifint| {{{1|{{LOCALYEAR}}}}} | {{#ifexpr: ( {{{1|{{LOCALYEAR}}}}} ) != 0 | {{#ifexpr: ( {{{1|{{LOCALYEAR}}}}} ) > 0 | {{expr| floor ( ( ( {{{1|{{LOCALYEAR}}}}} ) - 1 ) / 1000 ) + 1}} | {{expr| - (floor ( ( - ( {{{1|{{LOCALYEAR}}}}} ) - 1 ) / 1000 ) + 1)}} }} | {{error|Millennium error: There was no year 0 (the ancient Greeks or Romans had no concept of zero)}} }} | {{error|Millennium error: Year must be a nonzero unformatted integer}} }}
See also
- {{daynum}} gives the weekday number (0 to 6) for (Sun to Sat)
- {{day}} gives the standard three letter weekday abbreviation.
- {{fullday}} gives the full weekday name.
- {{monthnum}} gives the month number (padded left with 0 if necessary to get two decimal digits) (01 to 12)
- {{month}} gives the standard three letter month abbreviation.
- {{fullmonth}} gives the full month name.
- {{days in month}} (or {{monthdays}}) gives the number of days in a month (for any year from 1 AD to 10000 AD)
- {{yearday}} returns the day of year from year, month and monthday (for any year from 1 AD to 10000 AD)
- {{ifleapyear}} or {{if leap year}} returns different values depending on whether a given year is a leap year or a common year (for any year from 1 AD to 10000 AD)
- {{is leap year}} predicate function template returns 1 (if true) or 0 (if false) depending on whether a given year is a leap year or a common year (for any year from 1 AD to 10000 AD)
- {{Century}} returns the century for any nonzero (negative or positive) year
- {{Millennium}} returns the millennium for any nonzero (negative or positive) year
- {{to day of CE}} returns the day of CE (Christ Era) from year, month and monthday (for any year from 1 AD to 10000 AD)
- {{from day of CE}} returns year, month and monthday (for any year from 1 AD to 10000 AD) from the day of CE (Christ Era)
- {{date}} for date mathematics (for any year from 1 AD to 10000 AD) (returns the date offset a specified number of days from a given date)
- {{days between}} for date mathematics (for any years from 1 AD to 10000 AD) (returns the number of days between two dates)