Results 1 to 4 of 4

Thread: how to use GetTimeOfTheDay

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    i want to use the fucntion GetTimeOfTheDay function
    but i dont know how to
    i looked everywhere on msdn, but coundt find anything useful
    if you know how please let me know

    Code:
    GetTimeOfDay()
    that gives me error saying no function defined..

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    94

    Unhappy

    According to my MSDN this is a Java Function.

  3. #3
    Guest
    There is no GetTimeOfDay api function. You'll have to use the Time function vb has.

    But you can turn it into a function:

    Code:
    Private Function GetTimeOfDay() As String
    GetTimeOfDay = Time
    End Function
    
    Usage:
    
    Msgbox GetTimeOfDay

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Unhappy here.

    well since i coudn't find one that ms made
    i thought i make my own

    here it is if anyone else needs it
    Code:
    Public Function GetTimeOfDay() As String
        Dim theHour As Integer
        theHour = Hour(Time)
        If Val(theHour) <= 23 And Val(theHour) >= 16 Then
            GetTimeOfDay = "evening"
        ElseIf Val(theHour) < 16 And Val(theHour) >= 12 Then
            GetTimeOfDay = "afternoon"
        ElseIf Val(theHour) >= 0 And Val(theHour) <= 11 Then
            GetTimeOfDay = "morning"
        Else
            GetTimeOfDay = "early morning"
        End If
    End Function
    change the values based on what time you think evening, morning, afternoon ect start


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