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
Angie532Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
The Date type stores date and time.  Use Now() to get current date/time, and Format() to display it.

Dim dt As Date

'get the date/time now
dt = Now

'display
MsgBox _
"Today is " & Format(dt, "mm/dd/yyyy") & vbCrLf & _
"Time is  " & Format(dt, "hh:nn:ss AMPM")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erick37Commented:
You could also get date and time separately using Date() and Time() functions:

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")
0
Shane Russell2nd Line Desktop SupportCommented:
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")
0
Shane Russell2nd Line Desktop SupportCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.