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. How to Get Short date in Proper Format?

How to Get Short date in Proper Format?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
4 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.
  • M Offline
    M Offline
    mr_muskurahat
    wrote on last edited by
    #1

    hi i am using following function to get date.. gmdtrdate.Text = DateTime.Today.Date.ToShortDateString(); it is returning me 2/2/2008 can i get it like 02/02/2008 or i will have to attach 0 manually???

    umerumerumer

    G X 2 Replies Last reply
    0
    • M mr_muskurahat

      hi i am using following function to get date.. gmdtrdate.Text = DateTime.Today.Date.ToShortDateString(); it is returning me 2/2/2008 can i get it like 02/02/2008 or i will have to attach 0 manually???

      umerumerumer

      G Offline
      G Offline
      Gaurav K Singh
      wrote on last edited by
      #2

      use Response.Write(String.Format("{0:MM/dd/yyyy}", DateTime.Now()));

      The miracle is this--the more we share, the more we have.

      M 1 Reply Last reply
      0
      • G Gaurav K Singh

        use Response.Write(String.Format("{0:MM/dd/yyyy}", DateTime.Now()));

        The miracle is this--the more we share, the more we have.

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

        i dont want to hard code these values i just want to pick according to the regional date settings... if american then MM/dd/yyyy if british then dd/MM/yyyy ....

        umerumerumer

        1 Reply Last reply
        0
        • M mr_muskurahat

          hi i am using following function to get date.. gmdtrdate.Text = DateTime.Today.Date.ToShortDateString(); it is returning me 2/2/2008 can i get it like 02/02/2008 or i will have to attach 0 manually???

          umerumerumer

          X Offline
          X Offline
          Xmen Real
          wrote on last edited by
          #4

          I checked on mine, its returning 21-02-2009. And It depends on client regional settings.

          TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

          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