Results 1 to 6 of 6

Thread: Date & Time

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    How Do I make my program give the user the Date ad Time for example:

    Hello, today is Friday the 5th, and 10:32 PM (time moving)

    how do I do that?

    I have no idea how to get the systems time and date and stuff


    thanks in advance
    NXSupport - Your one-stop source for computer help

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Label1.Caption = "Hello. Today is " & Date & ", and " & Time
    End Sub
    
    Private Sub Timer1_Timer()
        '//Interval=1000
        Label1.Caption = "Hello. Today is " & Date & ", and " & Time
    End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    its that simple?
    no complicated code?
    NXSupport - Your one-stop source for computer help

  4. #4
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    WOrks for me

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    ok, I just tried it, and how do I get it to say:

    today is Friday the 9th, and 5:00 PM
    NXSupport - Your one-stop source for computer help

  6. #6
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    A little bit more complicated:
    Code:
    Option Explicit
    
    Private Sub Timer1_Timer()
        '//Interval=1000
        Dim intDay As Integer
        Dim strDay As String
        Dim FullDate As String
        
        Select Case Weekday(Date)
        Case 1
            strDay = "Sunday"
        Case 2
            strDay = "Monday"
        Case 3
            strDay = "Tuesday"
        Case 4
            strDay = "Wednesday"
        Case 5
            strDay = "Thursday"
        Case 6
            strDay = "Friday"
        Case 7
            strDay = "Saturday"
        End Select
        
        intDay = Day(Date)
        Select Case intDay
        Case 1, 21, 31
            FullDate = intDay & "st"
        Case 2, 22
            FullDate = intDay & "nd"
        Case 3, 23
            FullDate = intDay & "rd"
        Case Is > 3, Is < 21, Is > 23, Is < 31
            FullDate = intDay & "th"
        End Select
        Label1.Caption = "Hello. Today is " & strDay & " the " & FullDate & ", and " & Format(Time, "medium time")
    End Sub
    HTH

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