yanci1179
asked on
masked textbox
I am trying to use the Masked TextBox for date.
In the database data is stored as 1/12/2006 not 01/12/2006
I specified the _ _/_ _/_ _ _ _ for the mask and it works fine for entries with double digits for the month like
12/01/2006. If I have 1 digit months 1/1/2006 then it stores 11/20/06__
It shifts everthing to fit the mask. I changed the mask to _/_ _/_ _ _ _ and it works fine for the single months, but then it gets messed up for the double digit months.
How can I make it stop shifting over?
thanks.
In the database data is stored as 1/12/2006 not 01/12/2006
I specified the _ _/_ _/_ _ _ _ for the mask and it works fine for entries with double digits for the month like
12/01/2006. If I have 1 digit months 1/1/2006 then it stores 11/20/06__
It shifts everthing to fit the mask. I changed the mask to _/_ _/_ _ _ _ and it works fine for the single months, but then it gets messed up for the double digit months.
How can I make it stop shifting over?
thanks.
maybe you are passing the string to date without handling the spaces first?
//In the database data is stored as 1/12/2006 not 01/12/2006
Sorry, i din't read this,
yyes you are right, the value is wrong then.
You just have to do aut of dates like 1/2/1981 dates like 01/02/1981
Sorry, i din't read this,
yyes you are right, the value is wrong then.
You just have to do aut of dates like 1/2/1981 dates like 01/02/1981
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There will be a moment when you use the text inside your masked textbox to know a date. At this moment you can just say that a mont with one digit must be written as 0x (for example 01/01/1980) or you can just show at the text of the masked textbox (which could be like 1 /1 /1980) and make a usefull format like 01/01/1980 out of it.
If I have 1 digit months 1/1/2006 then it stores 11/20/06__ (i tryed to do it with 1 digit and it works fine for me so it must be a problem of your application)