你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

getyear()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

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