How can you get the day of year in VB.net if you input the integer value For Ex If you give 35 it should return Feb 4?

1 answer

Answer

1105461

2026-05-17 06:25

+ Follow

In VB.NET, you can convert an integer representing the day of the year to a date using the DateTime structure. You can achieve this by creating a new DateTime object that represents the first day of the year and then adding the integer value minus one to it. Here's an example:

<code class="language-vb.net">Dim dayOfYear As Integer = 35

Dim dateValue As DateTime = New DateTime(DateTime.Now.Year, 1, 1).AddDays(dayOfYear - 1) Console.WriteLine(dateValue.ToString("MMM d")) ' Outputs: Feb 4

</code>

This code will output "Feb 4" for the input value of 35.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.