Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Month Problem

Month Problem

Scheduled Pinned Locked Moved C#
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prabhakar dwivedi
    wrote on last edited by
    #1

    hello sir I'm trying to format the month name in dropdownlist. I have Month, such as 1,2,3,4,5,6, etc. I want them to display as Jan, Feb, Mar,April etc.ANd i want to show the current month in drop down as sep.help me thanks

    prabhakar dwivedi

    C A 2 Replies Last reply
    0
    • P prabhakar dwivedi

      hello sir I'm trying to format the month name in dropdownlist. I have Month, such as 1,2,3,4,5,6, etc. I want them to display as Jan, Feb, Mar,April etc.ANd i want to show the current month in drop down as sep.help me thanks

      prabhakar dwivedi

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I'm not sure where you're stuck. If you put the names into the list, you can get your number out by adding one to the selected index.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      • P prabhakar dwivedi

        hello sir I'm trying to format the month name in dropdownlist. I have Month, such as 1,2,3,4,5,6, etc. I want them to display as Jan, Feb, Mar,April etc.ANd i want to show the current month in drop down as sep.help me thanks

        prabhakar dwivedi

        A Offline
        A Offline
        aamironline
        wrote on last edited by
        #3

        Hi You can use DateTime.ToString method to achive this... This code will help you out

        for(int month=1; month<=12; month++)
        	dd.Items.Add(DateTime.Parse(string.Format("{0}/1/1", month)).ToString("MMM"));
        

        If you need full name of month then use MMMM instead of MMM.

        M Aamir Maniar aamirOnline.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups