Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default How do I change Date Format ??

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How do I change Date Format ??

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)



"Dan Thompson" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default How do I change Date Format ??

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" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default How do I change Date Format ??


"Dan Thompson" skrev i en meddelelse
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Change Date Format to Specific Text Format When Copying [email protected] Excel Discussion (Misc queries) 4 December 23rd 08 03:43 PM
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
Can I change a date with no format (20051111) to date format? Rose New Users to Excel 2 November 11th 05 09:03 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"