Results 1 to 3 of 3

Thread: [RESOLVED] 12-hour Time function syntax

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] 12-hour Time function syntax

    Hi all,

    I'm making a clock-type program, and it outputs the time to a label, updating it with a timer (the timer code has "Label.caption = Time"). However, I have a checkbox that will allow the user to tick to display the time in a 12-hour format rather than 24hour. I've looked on MSDN as the format:time function, but I don't think it's what i need, either that or I'm not implementing it properly.

    So basically, how do I use the "Time" function output 12-hour time?

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: 12-hour Time function syntax

    You need to use the format function:
    VB Code:
    1. '24 hours format
    2. Label1.caption = Format(Time,"hh:mm")
    3. '12 hours format
    4. Label1.caption = Format(Time,"hh:mm AMPM")
    CS

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: 12-hour Time function syntax

    Ah! That's great, thank you

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