Angie532
asked on
How do you get the data in VB6
What's the code that will give you today's date in Visual Basic 6?
Can you get the date separate from the time?
Thank you!
Angie
Can you get the date separate from the time?
Thank you!
Angie
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You can try and do it like so :
Dim strDate As String
strDate = Day(Now) & "/" & Month(Now) & "/" & Year(Now)
MsgBox strDate
MsgBox Format$(Now, "Medium Time")
Dim strDate As String
strDate = Day(Now) & "/" & Month(Now) & "/" & Year(Now)
MsgBox strDate
MsgBox Format$(Now, "Medium Time")
This site shows you what you can use within the format function, if you use short date within the format function , it will make it display the time in a 24 hour format :)
http://juicystudio.com/tutorial/vb/vbdates.asp
http://juicystudio.com/tutorial/vb/vbdates.asp
Dim dt As Date
Dim tm As Date
'get the date/time now
dt = Date
tm = Time
'display
MsgBox _
"Today is " & Format(dt, "mm/dd/yyyy") & vbCrLf & _
"Time is " & Format(tm, "hh:nn:ss AMPM")