Link to home
Start Free TrialLog in
Avatar of sirbounty
sirbountyFlag for United States of America

asked on

dtp value

I've got a date time picker control array.
When I run my app, (0) is set by default as 12:00 AM and (1) as 1:00 AM
But if I step through my code,
(0) contains the value of 11/30/1999 while (1) contains 1:00 AM as expected.

Any clue as to why?
Avatar of Erick37
Erick37
Flag of United States of America image

Is the .Format property set to dtpTime?
Avatar of sirbounty

ASKER

Nope - they're both custom.
Sorry - to clarify that custom format:

hh:mm tt
If you convert the value returned by the dtp to a double, with CDbl(yourdtpvalue), is it an integer number or is it divisible by 86400?  

There are 86400 seconds in a day and this can cause problems:

    0 seconds = the exact date
 1.0 days = an exact date
    1 second = 12:01:00AM

(I'm not explaining myself too well here, am I)

Try calculating the following:

    CDate (yourdtpvalue - Int(yourdtpvalue))

Does this return the correct times?

J.
debug.? CDate (dtpTime(0)- Int(dtpTime(0)))
returns
12:00:00 AM

as expected.

Right now, my workaround is:

dtpTime(0) = TimeValue(dtpTime(0))

Although I'd like to know why I need this only on the first element...
ASKER CERTIFIED SOLUTION
Avatar of jimbobmcgee
jimbobmcgee
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
Thanx for the explanation.  Now, for clarification, although redundant - should I also set the ending time to be Timevalue(dtpTime(1))??
Sorry for the delay...I was hoping I'd get a response on my last clarification question, but oh well...
Thanx for your help.