How do I change Date Format ??

  • Thread starter Thread starter Dan Thompson
  • Start date Start date
D

Dan Thompson

My code

Sub CurrentTime()
MsgBox Date
End Sub

This procedure outputs a message box that displays the current date.
The problem I am facing is the date outputs like this "16/1/2008" and I
want it to output so it displays like this "16-Jan-2008" or "Jan 16, 2008"

Can someone help me on this ??

Dan Thompson
 
Sub CurrentTime()
MsgBox Format(Date, "dd-mmm-yyyy")
End Sub

or

Sub CurrentTime()
MsgBox Format(Date, "mmm d,yyyy")
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Pick one of these...

Private Sub CurrentTime()
MsgBox Format$(Date, "dd-mmm-yyyy")
End Sub

Private Sub CurrentTime()
MsgBox Format$(Date, "mmmm dd, yyyy")
End Sub

Rick
 
Dan Thompson said:
My code

Sub CurrentTime()
MsgBox Date
End Sub

This procedure outputs a message box that displays the current date.
The problem I am facing is the date outputs like this "16/1/2008" and I
want it to output so it displays like this "16-Jan-2008" or "Jan 16, 2008"

Can someone help me on this ??

Dan Thompson

Hi Dan

Sub CurrentTime()
MsgBox Format(Date, "dd-mmm-yyyy")
MsgBox Format(Date, "mmm dd, yyyy")
End Sub

//Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top