PDA

Click to See Complete Forum and Search --> : Month names


Mark Sreeves
Dec 8th, 1999, 04:04 PM
Format(2,"dddd")
returns
Montag


What function or parameter of format() do I need to get 1 = Januar
12 = Dezember etc??

I can't Hard-code my own because it MUST use the system locale.


------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Andy Collyer
Dec 8th, 1999, 04:10 PM
Format(2,"mmmm")

HTH,

AndyC

Dec 8th, 1999, 04:13 PM
The format(2,"mmmm") doesn't work it returns the first month, (2 = 01-01-1900)

Try MonthName.



------------------

Vincent van den Braken
EMail: azzmodan@azzmodan.demon.nl
ICQ: 15440110 (http://www.icq.com/15440110)
Homepage: http://www.azzmodan.demon.nl

Mark Sreeves
Dec 8th, 1999, 04:15 PM
Thanks Andy but did you actually test this first?

------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Andy Collyer
Dec 8th, 1999, 04:15 PM
Beg yer pardon you're absolutely right I knew I shouldn't have got up this morning.

Apologies.

AndyC

[This message has been edited by Andy Collyer (edited 12-09-1999).]

Mark Sreeves
Dec 8th, 1999, 04:23 PM
I'm using VB5 not VB6 and MonthName isn't available

Anyway, I've just realised that the piece of code I was trying to make locale dependant isn't used anymore.

so I don't need a reply anyway

Thanks for the help though.




------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Serge
Dec 8th, 1999, 08:52 PM
Try this. Add a ComboBox to your form and paste this code to Form_load event:

Private Sub Form_Load()
Dim i As Integer

For i = 0 To 11
Combo1.AddItem Format(DateAdd("m", i, "1/1/" & Year(Date)), "mmmm")
Next
End Sub



------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)



[This message has been edited by Serge (edited 12-09-1999).]

Mark Sreeves
Dec 9th, 1999, 06:40 PM
Just incase any one is interested I've turned it into a function


Public Function MonthName(intMonth As Integer) As String
'by Mark Sreeves
'with thanks to Serge

Select Case intMonth
Case 1 To 12
MonthName = Format(intMonth & "/" & intMonth, "mmmm")

Case Else
MonthName = ""

End Select

End Function


------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Serge
Dec 9th, 1999, 08:32 PM
Mark, you can make your code a lot simplier, using buid-in VB function called MonthName

MsgBox MonthName(1) - Will return January and so on.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

onerrorgoto
Dec 9th, 1999, 08:44 PM
Thank you for the function Mark :)
It is working perfect

And Serge, then MsgBox MonthName(1) doesnt work in VB5 (atlest not for me) :(

------------------
On Error Goto Bed :0)
anders@zsystemdesign.se




[This message has been edited by onerrorgoto (edited 12-10-1999).]

Serge
Dec 9th, 1999, 08:57 PM
Yeap, sorry for that. MonthName function is available with VB6 only at the moment.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)