Retrieve date from database

M

michele

Hi, I want to load a listbox with the date that are stored in a database
(mdb), the problem is when I retrieve the date it has a format like
"01/01/2006 0.00.00". In Access the date is stored as short date.
Thanks in advice
 
J

Jerry H.

Try this:

dim dtDate as date
dtDate = format(Cdate([AccessDateField]), "MM/dd/yyyy hh.mm.ss")

I'm not 100% sure about this, but even though Access date fields
display as shortdate, I believe the stored value also contains the
Time, and if that is the case, the above code will display what you
need. But if only the Date is stored then the Time stamp portion will
likely return only "12.00.00"

Good luck!
 
M

michele

I try it and it works fine, thanks


Jerry H. said:
Try this:

dim dtDate as date
dtDate = format(Cdate([AccessDateField]), "MM/dd/yyyy hh.mm.ss")

I'm not 100% sure about this, but even though Access date fields
display as shortdate, I believe the stored value also contains the
Time, and if that is the case, the above code will display what you
need. But if only the Date is stored then the Time stamp portion will
likely return only "12.00.00"

Good luck!

Hi, I want to load a listbox with the date that are stored in a database
(mdb), the problem is when I retrieve the date it has a format like
"01/01/2006 0.00.00". In Access the date is stored as short date.
Thanks in advice
 

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

Top