Results 1 to 5 of 5

Thread: date/time using Format()

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    date/time using Format()

    I'm reformatting a date taken from a database, which is stored in the following format, where days/months/hours/minutes/seconds all have leading zeros:

    DD/MM/YYYY HH:MM:SS AM/PM

    I've already formatted it to how I want it, using this:

    VB Code:
    1. dateFormat = "d/mm/yy h:mm"
    2.         Format(CDate(qry!Time), dateFormat)

    This outputs the date as d/m/y h:m, with leading zeros only on months, years and minutes, and it works fine. The problem is that I can't get it to preserve the AM/PM, so is there any way to add that to it too using Format()? (and not resorting to using Left to get it from the original field value)
    Like Archer? Check out some Sterling Archer quotes.

  2. #2
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    342

    Re: date/time using Format()

    dateFormat = "d/mm/yy h:mm AMPM"

  3. #3

  4. #4
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: date/time using Format()

    Try
    VB Code:
    1. dateFormat = "d/mm/yy h:mm AM/PM"
    2.         Format(CDate(qry!Time), dateFormat)
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: date/time using Format()

    neato, thanks RhinoBull/tward.

    you're two minutes too late, but I suppose I could thank you as well Sean.
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width