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
Printable View
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
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
its that simple?
no complicated code?
WOrks for me
ok, I just tried it, and how do I get it to say:
today is Friday the 9th, and 5:00 PM
A little bit more complicated:
HTHCode: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