Click here to Skip to main content
15,947,958 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys i have table with a field called dateofbirth. When i enter data like 2/2/2012 through textbox its able to save the data in the table but in time format, how can i display(store) the value in date format
Updated 9-Aug-12 9:53am
[no name] 9-Aug-12 15:53pm    
What do you mean it saves the date in "time format"?
mayeso 9-Aug-12 15:57pm    
if i enter 2/2/2012, in the access database it will show 12:40AM
mayeso 9-Aug-12 16:00pm    
in other words it seems to be having a current date
ZurdoDev 9-Aug-12 16:02pm    
Dumb question, but are you entering the date with quotes around it? If not, Access is doing the math (2 divided by 2 divided by 2012) and storing that value as a datetime.
[no name] 9-Aug-12 16:07pm    
Weird. My Access 2007 does not do this. The only way I could come close to duplicating what you are saying is to set the format on the Date/Time column to Medium Time. Are you sure that you are not converting the data somehow when you save it?

Share this answer
StianSandberg 9-Aug-12 16:12pm    
Perfect answer
Sergey Alexandrovich Kryukov 9-Aug-12 16:15pm    
Thank you.
Maciej Los 9-Aug-12 17:19pm    
Sergey, i'm not sure your answer is 100% correct... In my opinion, the table structure is wrong. Please, see my answer.
Sergey Alexandrovich Kryukov 9-Aug-12 17:23pm    
I don't understand where did you see a table structure and how it makes the answer wrong, sorry. Essentially, it just says OP can create present data in any format.
Maciej Los 9-Aug-12 17:30pm    
Maybe, i'm wrong ;)
Use parameterized queries in your VB application. Access is really terrible when it comes to date time formats - month and day can be swapped around, the regional settings can be ignored!
Next, do not care for the displayed value in Access when you open the table there. Take care that your VB application formats the value correctly, e.g. with a ToString("MM/dd/YYYY").
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900