Results 1 to 11 of 11

Thread: time format

  1. #1
    Join Date
    Nov 2003
    Posts
    74

    Unanswered: time format

    hi,

    how can i retrieve the time to display as 11.30.29am in the manner of hour.minute.seconds format??? i want it to be 11.30.29am not 11:30:29am.


    pls advice
    nono

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: time format

    Originally posted by damnnono_86
    hi,

    how can i retrieve the time to display as 11.30.29am in the manner of hour.minute.seconds format??? i want it to be 11.30.29am not 11:30:29am.


    pls advice
    nono
    You can change it to a string, then use the instr function to search the : then use the MID function to make the substring and insert your period or point [.]

  3. #3
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Thumbs up Use Format function

    SELECT format(TableX.Time,"HH.MM.SS")
    FROM TableX;

  4. #4
    Join Date
    Nov 2003
    Posts
    74
    hi hammbakka,

    can u further explain ???


    hi Marvels,

    this is what i have write in my code, but it still gives me in this semi colon format.

    fTime = Time

    MsgBox fTime '10:25:03 pm
    fTime = Format(fTime, "hh.nn.ss ampm")
    MsgBox fTime '10:25:03 pm

    pls advice
    nono

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb Re: time format

    Originally posted by hammbakka
    You can change it to a string, then use the instr function to search the : then use the MID function to make the substring and insert your period or point [.]
    cTime= cStr("11:10:09")
    h=mid(cTime,1,2)
    m=mid(cTime,4,2)
    s=mid(cTime,6,2)
    newTime=h & "." & m & "." & s

  6. #6
    Join Date
    Nov 2003
    Posts
    74
    hi,

    thanks. the code works.

    nono

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by damnnono_86
    hi,

    thanks. the code works.

    nono
    Good that it functions

  8. #8
    Join Date
    Nov 2003
    Posts
    1,487

    Re: time format

    Originally posted by damnnono_86
    hi,

    how can i retrieve the time to display as 11.30.29am in the manner of hour.minute.seconds format??? i want it to be 11.30.29am not 11:30:29am.


    pls advice
    nono

    Hmmmmm.....

    MsgBox Time
    MsgBox Format(Time, "hh.mm.ssampm")


    Works fine

  9. #9
    Join Date
    Nov 2003
    Posts
    74

    Talking

    yup.

    that works too!

    thanks to all
    nono

  10. #10
    Join Date
    Oct 2003
    Posts
    706
    I'd suggest using the format() function in some way, as opposed to using substrings, MID() and all-of-that.

    The reason is that format() is designed to be portable, international-friendly and all of that. The other method is not: it only works for the case for which it is designed, and when that changes, "it breaks." You really want to avoid that if you can.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  11. #11
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Hi

    Originally posted by damnnono_86
    hi hammbakka,

    can u further explain ???


    hi Marvels,

    this is what i have write in my code, but it still gives me in this semi colon format.

    fTime = Time

    MsgBox fTime '10:25:03 pm
    fTime = Format(fTime, "hh.nn.ss ampm")
    MsgBox fTime '10:25:03 pm

    pls advice
    nono

    Try This

    fTime = Time

    MsgBox fTime '10:25:03 pm
    MsgBox Format(fTime, "hh.nn.ss ampm") '10.25.03 pm

Posting Permissions

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