metropia
asked on
calculate week ending
hi,
I need to calculate the week ending based on a date provided by the user in a asp.net form.
I am using C#. The calculation of the week ending would be placed here:
Thanks!
I need to calculate the week ending based on a date provided by the user in a asp.net form.
I am using C#. The calculation of the week ending would be placed here:
if (dt.HasValue)
{
Session["Date"] = dt;
In here <<
}
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://msdn.microsoft.com/en-us/library/system.datetime.dayofweek
Once you know what day of the week it is, it should become clear how many days it is until the end of the week depending on what you define as the end of the week. For example, if "Sunday" is the end of the week, and it currently is "Thursday", then you know that the end of the week is 3 days in the future.
You can advance your date by that many days using the DateTime.AddDays() function, and you should have a datetime set to the end of the week.
http://msdn.microsoft.com/en-us/library/system.datetime.adddays