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. Web Development
  3. ASP.NET
  4. Get month name and last date form date time

Get month name and last date form date time

Scheduled Pinned Locked Moved ASP.NET
4 Posts 4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi All, I have got this date 4/1/2010 12:00:01 AM from my text box and i converted it into the Date time (this date is April) i know the today date time using Datetime.now So i want all end date of month in the following format 30 Apr 31 May thanks amit

    E R 2 Replies Last reply
    0
    • L Lost User

      Hi All, I have got this date 4/1/2010 12:00:01 AM from my text box and i converted it into the Date time (this date is April) i know the today date time using Datetime.now So i want all end date of month in the following format 30 Apr 31 May thanks amit

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      You must specify a date format you want to use to display the date. This should do the trick :

      DateTime.Now.ToString("d MMM yyyy hh:mm:ss");

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      M 1 Reply Last reply
      0
      • E Eduard Keilholz

        You must specify a date format you want to use to display the date. This should do the trick :

        DateTime.Now.ToString("d MMM yyyy hh:mm:ss");

        .: I love it when a plan comes together :. http://www.zonderpunt.nl

        M Offline
        M Offline
        maltova
        wrote on last edited by
        #3

        following will displat the last date of the present month. day(DateSerial(Year(datetime.Now), Month(datetime.Now), 0))

        1 Reply Last reply
        0
        • L Lost User

          Hi All, I have got this date 4/1/2010 12:00:01 AM from my text box and i converted it into the Date time (this date is April) i know the today date time using Datetime.now So i want all end date of month in the following format 30 Apr 31 May thanks amit

          R Offline
          R Offline
          Refwah
          wrote on last edited by
          #4

          You can use DateTime.Now.Month to return an int representation of the month. You can pass this to a function to switch on for the month name, IE:

          switch(month)
          {
          case 1:
          return "January";
          case 2:
          return "Feburary";
          }

          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