473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DateTimePicker Control Set time to 00:00:00 instead of current time

Hi

I have a form with the DateTimePicker control on it. When I select a date it gives a value like "date time" (Eg.: 5/12/2010 12:20:35 PM). But here the time returned is current time. What I need is for the date chosen from the picker automatically set the time to 00:00:00 instead of the time when the date was picked.

Any suggestions?

Thanks.
May 12 '10 #1
3 5649
tlhintoq
3,525 Expert 2GB
I would first make a new DateTime object with everything zeroed, then add in the date only, that the user picked

Otherwise subtract the time from what the user picked using the .addhour(), addminute(), etc methods
May 12 '10 #2
tlhintoq
3,525 Expert 2GB
You must be doing the same outsourced project as this guy:
http://bytes.com/topic/net/answers/8...ly#post3571255
May 12 '10 #3
Curtis Rutland
3,256 Expert 2GB
It's a more common question than I would have thought, tlhintoq. I've actually created a user-defined function on our SQL Servers for trimming dates to different dateparts. We had a project where we needed to, in one view, group results by minute, and in another, group by day. So we used the function to get two different trimmed versions of the record date for different groupings.

DateTime objects are great, but it would be nice if they had some methods like TrimToMonth/TrimToDay/TrimToMinute.
May 12 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sunny K | last post by:
Hi, I am having a problem with aquery. Firstly here is a script to create the table and insert some sample data: CREATE TABLE . ( (17) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , ...
8
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec(...
2
by: MarthaR | last post by:
I am trying to add the current time to a field when the user clicks on the toggle button next to the field. I am getting a time of 12:00:00 AM each time I click the button. How do I get a...
2
by: clintonG | last post by:
How do I format the current time as: 8:00 PM (GMT -06:00) <%= Clinton Gallagher
4
by: Gary Wessle | last post by:
Hi I am not getting current time with this program, what am I doing wrong? #include <ctime> #include <iostream> using namespace std; #define P(x) cout << #x " = " << (x) << "\n";
8
by: rhepsi | last post by:
Hii all, im doin a vb project where i need to update the current date..?? (vb) Private Function updateDate(ByVal strDate As String) As String 'to convert valid date format ...
9
by: Kyote | last post by:
I have a textbox that is databound to a table in an access database. The field only contains month/day/year but my databound textbox is also showing a time. Is there any way to prevent it from...
13
by: dizzydangler | last post by:
Just a quick question...I'm running an MS Access 2007 db that tracks appointments in a single table. Date and time are entered as separate fields in short date (mm/dd/yyyy) and short time (hh:mm)...
1
by: samvb | last post by:
Hi, I am working on a small vb6 and access project and I am totally crazy over the way time works! There are runners and I need to store the time it took each runner to complete the race. If...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.