Results 1 to 11 of 11

Thread: Month names

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    London, UK
    Posts
    58

    Post

    Format(2,"mmmm")

    HTH,

    AndyC

  3. #3
    Guest

    Post

    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
    Homepage: http://www.azzmodan.demon.nl




  4. #4

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Thanks Andy but did you actually test this first?

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

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

  5. #5
    Member
    Join Date
    Jan 1999
    Location
    London, UK
    Posts
    58

    Post

    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).]

  6. #6

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this. Add a ComboBox to your form and paste this code to Form_load event:
    Code:
    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



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

  8. #8

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Just incase any one is interested I've turned it into a function

    Code:
    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

  9. #9
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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


  10. #10
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Post

    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).]

  11. #11
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width