Formatting date

Brendon

Member
Licensed User
Longtime User
Hi All,
does anyone knows how to format date in long format like monday 2nd January 2012?

Kind regards to everyone
 

aedwall

Active Member
Licensed User
Longtime User
How do I format the date if it is not "now"? Let's say I want to format 12/25/2004 as 25 Dec 2004. What is the correct syntax? Thank you.
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
Thank you for your help. But I have tested the below and it does not work - I reported this in a bug report - the month always comes up as Jan. no matter what date I specify.

'this doesn't work correctly
DateTime.DateFormat = "mm/dd/yyyy"
Dim dt1 As Long
dt1 = DateTime.DateParse("09/22/1949")

DateTime.DateFormat = "dd MMM yyyy"

Log(DateTime.Date(dt1))


Here is what I have in a test program:

Sub Activity_Create(FirstTime As Boolean)
Dim dt1, dt2 As Long

DateTime.DateFormat = "mm/dd/yyyy"
dt1 = DateTime.DateParse("09/22/1949")
dt2 = DateTime.DateParse("4/6/1965")

DateTime.DateFormat = "dd MM yyyy" 'this should be MMM, not MM
Log(DateTime.Date(dt1))
Log(DateTime.Date(dt2))
End Sub

The result is seen in the attached picture file.

NOW, WAIT, I changed:

DateTime.DateFormat = "mm/dd/yyyy"

to

DateTime.DateFormat = "MM/dd/yyyy"

and you see the difference it made.

I could have sworn that 'mm' meant months as a number. Guess I am too used to PHP.

Sorry to bother you - thanks for your help.
 

Attachments

  • ScreenShot_01-29-12 00;11;19001.gif
    ScreenShot_01-29-12 00;11;19001.gif
    5.6 KB · Views: 232
  • ScreenShot_01-29-12 00;12;11001.jpg
    ScreenShot_01-29-12 00;12;11001.jpg
    19.7 KB · Views: 197
Last edited:
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
MM is for months.
mm is for minutes.

In VB6 Microsoft used nn for minutes.

Rolf
 
Upvote 0
Top