Results 1 to 6 of 6

Thread: [RESOLVED] Why does it give me an error when i use Hour?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Resolved [RESOLVED] Why does it give me an error when i use Hour?

    I know that Hour is a vb defined code, but it gives me an error when i set a variable = hour. why?

    Code:
    Dim i
    i = Hour
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  2. #2
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Why does it give me an error when i use Hour?

    The Hour() function requires a Datetime argument. If you're looking for the Hour() as of right now, use the Now() function:

    i = Hour(Now())

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Why does it give me an error when i use Hour?

    Or
    Code:
    Private Sub Command1_Click()
    MsgBox Format(Now, "hh")
    End Sub

  4. #4
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Why does it give me an error when i use Hour?

    Or
    Code:
    Dim h as Integer
    h = Hour(Time)
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Why does it give me an error when i use Hour?

    Oh. That makes sense. Thanks guys!
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  6. #6
    New Member
    Join Date
    Oct 2010
    Posts
    2

    Re: [RESOLVED] Why does it give me an error when i use Hour?

    yea nice !

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