Visual Basic code to convert Current time (12hr) to 24 hour

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stephie3883
    New Member
    • Feb 2013
    • 6

    Visual Basic code to convert Current time (12hr) to 24 hour

    I need to create a code that converts the current 12hr time to 24hr time (excluding seconds). so far i have:

    Code:
    Sub x24hr_time
    Dim currenttime As String
    currenttime=TimeOfDay.ToString("hh:mm")
    But how do you enter in the current time to Visual basic?
    Last edited by Rabbit; Feb 28 '13, 04:51 AM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What you have there looks like VB.Net code instead of VB6, let me know what language you're using and I can move it to the right forum if you're in the wrong one.

    Comment

    • stephie3883
      New Member
      • Feb 2013
      • 6

      #3
      The program is suppose to be in VB6, i think i got my commands confused

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        I believe in VB6, the Now function returns the current date and time. You can combine that with the Format function to display it in whichever format you define.

        Comment

        Working...