Date field - leading ZERO for days1 to 9

darbid

Registered User.
Local time
Today, 22:51
Joined
Jun 26, 2008
Messages
1,428
I have a text box for a date.

I have it formated to "Shortdate"

I have noticed that it cuts the first zero off. eg

5/07/2010

or us 7/05/2010

I would like 05/07/2010

is there a way to fix this?

I need to enter the date into another system that for whatever reason requires the leading 0.

Thanks in advance guys.
 
Use an input mask

99/99/0000;0;0_

Are you sure you have set the data type to b date/time?
 
Use an input mask

99/99/0000;0;0_

Are you sure you have set the data type to b date/time?

I am dealing with an unbound txtbox.

I have just seen that making the "ShortDate" format of course then looks at the computers regional settings. My regional settings for shortdate are "5/07/2010"

which is the reason why there is no leading 0

With your suggested input mask

if I make the "txtbox = Date" then I get "5/07/2010" then when the txtbox gets focus it changes to "50/07/2010". as soon as it looses focus it goes back to "5/07/2010"

Given that it is regional settings dependent I think I will have to always test the first two characters of the string.
 
If you regional settings trim of the leading zeros then your control will do also.
 
If you regional settings trim of the leading zeros then your control will do also.
Yep that was the problem. But as the DB may have a user with any kind of Regional Setting Format for a short date I will have to alter the date as a string later on in my code.

Thank you for your help.
 

Users who are viewing this thread

Back
Top Bottom