# Template:ISOyear

*This documentation is transcluded from Template:ISOyear/doc.*

Extracts year from calendar dates in ISO 8601 *extended format* (YYYY-MM-DD, e.g. "2016-01-26"). This template is very similar to {{#time: Y}} parser function , but accepts a year as input, even in cases where #time would interpret that as a time. In the case of wrong input template does not return anything.

## Usage

{{ISOyear |1= }}

### Template parameters

Parameter | Description | Default | Status | |
---|---|---|---|---|

`1` |
date in ISO 8601 format. Supported formats: YYYY-MM-DD, YYYY-MM, YYYY. Other formats not officially supported but returning correct results include: single digit months and days and years without months or days can have any number of digits. Supported dates are any proleptic Gregorian calendar or Gregorian calendar dates between 1 January 0001 AD and 31 December 9999 AD. | empty | required |

### Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:

Module:Date

## See also

{{ISOdate}}

## Localization

This template is not intended to be localized.

## Testing

More tests can be found at Template:ISOyear/testcases.

YYYY-MM-DD tests:

- {{
**ISOyear**|2009-09-09}} gives "2009" - {{
**ISOyear**|2009-09-9}} gives "2009" - {{
**ISOyear**|2009-9-09}} gives "2009" - {{
**ISOyear**|0909-09-09}} gives "0909" - {{
**ISOyear**|909-09-09}} gives "0909" - {{
**ISOyear**|0099-09-09}} gives "0099" - {{
**ISOyear**|099-09-09}} gives "0099" - {{
**ISOyear**|99-09-09}} gives "0099" - {{
**ISOyear**|+2009-09-09}} gives "" - {{
**ISOyear**|-2009-09-09}} gives "-2009" - {{
**ISOyear**|2009-13-09}} gives "2009" - {{
**ISOyear**|2009-09-35}} gives "2009" - {{
**ISOyear**|2009+09+09}} gives "" - {{
**ISOyear**|2009/09/09}} gives "" - {{
**ISOyear**|2009 09 09}} gives ""

YYYY-MM tests:

- {{
**ISOyear**|2009-09}} gives "2009" - {{
**ISOyear**|2009-9}} gives "2009" - {{
**ISOyear**|2009-13}} gives "2009" - {{
**ISOyear**|0909-09}} gives "0909" - {{
**ISOyear**|909-09}} gives "0909" - {{
**ISOyear**|0100-09}} gives "0100" - {{
**ISOyear**|0099-09}} gives "0099" - {{
**ISOyear**|099-09}} gives "0099" - {{
**ISOyear**|99-09}} gives "0099" - {{
**ISOyear**|+2009-09}} gives "" - {{
**ISOyear**|-2009-09}} gives "-2009" - {{
**ISOyear**|2009/09}} gives "" - {{
**ISOyear**|2009+09}} gives ""

YYYY tests:

- {{
**ISOyear**|2009}} gives "2009" - {{
**ISOyear**|+2009}} gives "2009" - {{
**ISOyear**|-2009}} gives "-2009" - {{
**ISOyear**|0999}} gives "0999" - {{
**ISOyear**|999}} gives "0999" - {{
**ISOyear**|0099}} gives "0099" - {{
**ISOyear**|099}} gives "0099" - {{
**ISOyear**|99}} gives "0099" - {{
**ISOyear**|9}} gives "0009" - {{
**ISOyear**|0}} gives "0000"

0ther:

- {{
**ISOyear**}} gives "" - {{
**ISOyear**|hello}} gives ""