Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
First day of month
Message
 
To
26/11/2002 11:39:13
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00727074
Message ID:
00727084
Views:
12
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform