467,222 Members | 1,459 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,222 developers. It's quick & easy.

Retrieve date from database

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
Aug 4 '06 #1
  • viewed: 1347
Share:
2 Replies
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!
michele wrote:
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
Aug 4 '06 #2
I try it and it works fine, thanks
"Jerry H." <bo*********@gmail.comha scritto nel messaggio
news:11*********************@m73g2000cwd.googlegro ups.com...
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!
michele wrote:
>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

Aug 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Daniel Tonks | last post: by
4 posts views Thread by Simon Gare | last post: by
reply views Thread by Adict | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.