datetime class : Year getter

Description

Gets the year portion represented by this instance.

Syntax

datetimeInstance.Year

Arguments

None

Return value

ClassDescription
intYear portion of datetime (from 1 to 9999)

Sample code

1:

datetime dt = new datetime(2016, 3, 4, 4, 13, 0);

2:

int year = dt.Year; // 2016

Notes

It's a wrapper of the System.DateTime.Year property.

Links for reference

Copyright © Cooker All rights reserved.