DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    16

    Exclamation how to determine morning,afternoon,evening.

    hi,phil
    fine here.
    there ?

    how to indentify system time is a (morning/afternoon/evening/night).

    thanks..
    -LiveSys

  2. #2
    Join Date
    Aug 2005
    Posts
    85
    MsgBox Format$(Time, "Long Time")

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    First, you need to define which hours you consider morning, afternoon, evening and night. Let's say 5:00 a.m. to noon are morning, noon to 5:00 p.m. are afternoon, 5:00 to 9:00 p.m. are evening, and 9:00 p.m. to 5:00 a.m. are night.

    Then you compare the current time against those brackets:
    Code:
    Dim hr As Integer
    
    hr = Hour(Now)
    Select Case hr
        Case Is >= 21
            MsgBox "Good night"
        Case Is >= 17
            MsgBox "Good evening"
        Case Is >= 12
            MsgBox "Good afternoon"
        Case Is >= 5
            MsgBox "Good morning"
    End Select
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Feb 2007
    Posts
    16

    Thumbs up Thanks..

    perfect.

    thanks phil,
    -LiveSys

Similar Threads

  1. Replies: 0
    Last Post: 02-06-2007, 04:56 PM
  2. Replies: 0
    Last Post: 11-02-2001, 04:49 PM
  3. Replies: 0
    Last Post: 11-02-2001, 04:49 PM
  4. Replies: 0
    Last Post: 06-08-2001, 01:03 PM
  5. Determine Printer's state
    By Carlo Manuali in forum VB Classic
    Replies: 2
    Last Post: 08-30-2000, 01:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links