From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Integer )
IntegerValue = aXojo.Core.Date.DayOfYear

Supported on Mobile (iOS).

The number of days into the year, 1-based. January 1st is 1.

Sample Code

Get the day of the year:

Var yearDay As Integer = Xojo.Core.Date.Now.DayOfYear

To check to see if a year is a leap year, you can create a date on the last day of the year (Dec 31) and then check DayOfYear to see if it is greater than 365. For example:

Var year As Integer = 2020
Var d1 As New Xojo.Core.Date(year, 12, 31, Xojo.Core.TimeZone.Current)
If d1.DayOfYear > 365 Then
// Leap Year!
// Not a leap year
End If