Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
First day of month
Message
 
À
26/11/2002 11:39:13
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00727074
Message ID:
00727084
Vues:
13
>Using C#, how do you get the first day in the current month? Or the last day in the current month?
>
>Thanks,
>
>Jerry

You can use code like:
System.DateTime dateFirstOfMonth = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month, 1, 0, 0, 0);
System.TimeSpan oneDay = new System.TimeSpan(1, 0, 0, 0, 0);
System.DateTime dateLastOfMonth = dateFirstOfMonth.Subtract(oneDay);
You'll have to adjust it for the first of the current month, but hopefully the code gives you an idea on how. There might be other ways...
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform