Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Getting separate values for hours and minutes from a DateTimePicke

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pierre - 19 Jun 2007 18:43 GMT
Hello,
I am using a DateTimePicker set to retrieve time information only.  I would
like to separately set the hour increment to 1 and the minutes increment to
30 but I cannot find out how I can use the different sections in the control.
Does anybody has an idea?

Thank you for your attention.

Regards,
Signature

Pete

Ahmed - 19 Jun 2007 19:18 GMT
> Hello,
> I am using a DateTimePicker set to retrieve time information only.  I would
[quoted text clipped - 7 lines]
> --
> Pete

Well you can use the DateTime methods for this as follows

DateTime t = now;
DateTime tplus1hr30sec = t.AddHours(1);
tplus1hr30sec = t.AddMinutes(30);

and there you go, you have a time set 1:30 min apart time "t".

Hope this answers your question :)
Pierre - 19 Jun 2007 20:05 GMT
Hello Ahmed,
Thanks for your answer, it is going to help me for sure.

However what I was looking for is the control's possibility but it looks
like we cannot access to the different sections of the time control.

I already did this job years ago in C++ by grouping textbox and spin control
into a dialog but I expected that the C# control encapsulated this for us.

Once again, thanks a lot.
Pierre
Signature

Pete

> > Hello,
> > I am using a DateTimePicker set to retrieve time information only.  I would
[quoted text clipped - 17 lines]
>
> Hope this answers your question :)
Jared - 19 Jun 2007 21:32 GMT
Me.DateTimePicker1.Value.ToShortTimeString()

Dim T As DateTime

T = New DateTime(0, 0, 0, Me.DateTimePicker1.Value.Hour,
Me.DateTimePicker1.Value.Minute, Me.DateTimePicker1.Value.Second)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.