getyear()
Returns the year part of the datetime
argument.
Syntax
getyear(
date)
Learn more about syntax conventions.
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
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for