Displaying dates in dd/mm/yy format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two Date/Time fields in my Access 2003 database. The VB.NET app I'm
developing (and making some real progress with) uses TextBoxes to input these
as part of a record in a DataSet. Problem: Access always stores years as 4
digits, and it automatically tags a time onto the field, so when the user
enters:

30/11/04

I end up with:

30/11/2004 00:00:00

when I view the record after it's created; the DataSet is populated using
the database schema. Since the TextBox is set to display only 8 characters,
this is annoying at best. The only way I can think of around this is to store
the date as a string and write a validation handler for each TextBox that
inputs dates.

But is there a better way? Can I somehow force Access to store the short
date and nothing else?
 
the short date also contains time information.

You can however format the string to shortformat.

if you want to input dates why don't you use the datetimepicker and format
it to shortdateformat.
 
Thanks, George. Actually, about half an hour after I posted the question I
did what I usually do: arrive at a possible solution.

The answer is to reformat the text in the TextBox using the String.Format
method to display it as dd/mm/yy. This has no effect on how it's stored in
the database, but for display purposes that doesn't matter...something I only
realised after I'd posted.

Sorted!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top