Retrieve date from database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • michele

    #1

    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


  • Jerry H.

    #2
    Re: Retrieve date from database

    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

    Comment

    • michele

      #3
      Re: Retrieve date from database

      I try it and it works fine, thanks


      "Jerry H." <boilersrock@gm ail.comha scritto nel messaggio
      news:1154695566 .003554.85760@m 73g2000cwd.goog legroups.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
      >

      Comment

      Working...