getyear()
Learn how tow use the getyear() function to return the year of the
datetime input.Returns the year part of the datetime argument.
Syntax
getyear(date)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| date | datetime | ✔️ | The date for which to get the year. |
Returns
The year that contains the given date.
Example
print year = getyear(datetime(2015-10-12))
| year |
|---|
| 2015 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.