Today is 5.27.2010
- this means it is day 147 of this year.
How do I calculate that today is 147 based on the current date?
There's a DateTime
property named just that: DayOfYear
Console.WriteLine(DateTime.Now.DayOfYear);
Or for any date:
var d = new DateTime(2010, 5, 30);
Console.WriteLine(d.DayOfYear);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With