Friday 27 September 2013

Function to get a value between 1 and N using DateTime.DayOfYear Property

Function to get a value between 1 and N using DateTime.DayOfYear Property

I'm developing an application that has a table with N rows. I'm using C#
and SQL Server.
I have to retrieve a different row each day. For example, on December,
22nd, I have to retrieve row 1. On December, 23rd, I have to retrieve row
2, etc.
I need a function that returns a number from 1 to N, using
DateTime.DayOfYear Property to get it.
Maaybe I need to do something like this (DateTime.DayOfYear mod N), to do
what I want to do.
What do I have to do?

No comments:

Post a Comment