Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates
Message
 
À
09/01/2004 11:08:48
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Re: Dates
Divers
Thread ID:
00865458
Message ID:
00865670
Vues:
17
Hi Jim,

To get the first and last day of the week, you can use the following set of code:
int DaysToStartOfWeek = (int) DateTime.Today.DayOfWeek;

int DaysToEndOfWeek = (int)DayOfWeek.Saturday - (int)DateTime.Today.DayOfWeek;

DateTime StartWeek = DateTime.Today.Subtract(new TimeSpan(DaysToStartOfWeek,0,0,0));

DateTime EndWeek = DateTime.Today.Add(new TimeSpan(DaysToEndOfWeek,0,0,0));
>All,
>
> I am creating a webpage that lets the user select a daterange(today, this week, this month, etc). I got most of it to work, but don't know how to figure the this week portion of my task. Can someone please help?
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform