Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

i need to ge the first day and the last day from a datetime piker date

Posted on 2007-08-08
6
Medium Priority
?
290 Views
Last Modified: 2013-11-05
hi there ,
i have 3 datetimepikers in the WinForm
if the user pick 05/08/2008 in the first DP
in the second i need to get 01/08/2008
in the last DP i need to get 31/08/2008
how can i do it ?

thanks ....
0
Comment
Question by:Tech_Men
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19654417
Are you asking how to get a value from the DateTimePicker?

  dtp1.Value

Bob
0
 

Author Comment

by:Tech_Men
ID: 19654448
i need to get the value and set the othersin

the second i need to get 01/08/2008
in the last DP i need to get 31/08/2008
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19654505
What is the criteria for specifying the dates for the other DateTimePicker controls?

Bob
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:sabeesh
ID: 19654552
       DateTime firstday = date.Date.AddDays(-(DateTime.Now.Day));
0
 
LVL 8

Expert Comment

by:sabeesh
ID: 19654593
sorry

try this

DateTime date = new DateTime(2008,8,18);
        DateTime firstday = date.Date.AddDays(-(date.Day));
        DateTime lastday = date.Date.AddDays(DateTime.DaysInMonth(date.Year,date.Month) - date.Day));
0
 
LVL 8

Accepted Solution

by:
sabeesh earned 2000 total points
ID: 19654627
small correction

  DateTime date = new DateTime(2008,2,18);
        DateTime firstday = date.Date.AddDays(-(date.Day) + 1);
        DateTime lastday = date.Date.AddDays(DateTime.DaysInMonth(date.Year,date.Month) - date.Day);
       
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question