Link to home
Start Free TrialLog in
Avatar of MikeORTEC
MikeORTEC

asked on

Showing time in date time picker

The selections for the ms date time picker dont seem to give an option to show a date like 03/23/05 12:00 PM. I am sure that I can format the thing so that I can show the time and make it possible for the user to edit the date and the time...does someone know how to set this property?
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you doing this in visual basic 6.0 ? If not what language ?
Avatar of MikeORTEC
MikeORTEC

ASKER

I am doing this in VB6...sorry
I used the PAQ to format the dtp in the following way:

DTPicker1.Format = dtpCustom
DTPicker1.CustomFormat = "mm/dd/yyyy hh:mm tt"

The date and time now load as I wanted them to, eg 03/23/2005 12:00 PM in the dtp.

But, changing the seconds in the time on the form, changes the month and vice versa...these seem to be somehow connected...if I scroll or change the seconds to 00, the month changes to 00 also....how do I format so that the changes are not tied to each other?
let me try something out and I will get back to you :)
Have you got 2 DT Pickers ? one for time and one for date ?
There are two DT pickers, but I need Date and time for each.  I guess that I could split them, but that would complicate the code.  I am sure that I have seen a DTP with both Date and Time included.  and I have managed to get both in there, but the erroneous linking of time with month needs to be solved.

Thansk.

Miike
What I would like to be able to do in the first one is get a date from the database in the following format

mm/dd/yyy hh:mm:ss tt

The second one should be set to "today" Noon

like

03/25/2005 12:00:00 PM

it always loads as AM and the minutes and month scroll together for some reason.

Thanks for the assistance!
ASKER CERTIFIED SOLUTION
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear Gecko,

Thanks, I appreciate you taking the time to look at this, but I figured it out.  the problem was that my custom format was mm/dd/yyy hh:mm:ss tt, but should have been capitalized for the month formatting, so it should have been like

MM/dd/yyy hh:mm:ss tt             'note the capitalized MM

This appears to allow me to have it all encapsulated in one control.  Last thing to do is find the property to set a dtp control date to todays date at run time....like the excel property =today() or =now() for individual cells.

I cannot seem to find this property of the control itself...i guess there would be a way to get it from windows and pass it to the control,but I dont know how...

Any help?
When I had DTPicker1 it had Hour, minute, second and date or something like that so maybe you need to concatenate them ie

DTPicker1.Hour & ":" & DTPicker1.Minute & ":" & DTPicker1.Second

and then something like that for the date ?