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. Time format

Time format

Scheduled Pinned Locked Moved ASP.NET
help
6 Posts 5 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.
  • I Offline
    I Offline
    Imran Khan Pathan
    wrote on last edited by
    #1

    Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

    GOD HELP THOSE WHO HELP THEMSELVES

    L B G M 5 Replies Last reply
    0
    • I Imran Khan Pathan

      Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

      GOD HELP THOSE WHO HELP THEMSELVES

      L Offline
      L Offline
      Lijo Rajan
      wrote on last edited by
      #2

      U have to store the time,date,year in seperate variable.Then u can take time alone. DateTime dtDOB = Convert.ToDateTime(drFieldRetrieve["dateof_birth"]); string strDay = dtDOB.Date.Day.ToString(); string strMonth = dtDOB.Month.ToString(); string strYear = dtDOB.tYear.ToString(); string strTime = dtDOB.TimeOfDay .ToString(); Hope that u r expecting like this.

      1 Reply Last reply
      0
      • I Imran Khan Pathan

        Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

        GOD HELP THOSE WHO HELP THEMSELVES

        B Offline
        B Offline
        Blumen
        wrote on last edited by
        #3

        Hi Pathan, Try this. DateTime.Today.ToString("t"); This will return just the time in AM/PM format. Regards, Blumen

        1 Reply Last reply
        0
        • I Imran Khan Pathan

          Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

          GOD HELP THOSE WHO HELP THEMSELVES

          B Offline
          B Offline
          Blumen
          wrote on last edited by
          #4

          for reference you may try this as well: http://msdn2.microsoft.com/en-us/library/az4se3k1.aspx

          1 Reply Last reply
          0
          • I Imran Khan Pathan

            Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

            GOD HELP THOSE WHO HELP THEMSELVES

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            The "t" format applies to dates, not strings. String.Format("{0:t}",new DateTime(2007, 11, 19, 10, 0, 0));

            --- single minded; short sighted; long gone;

            1 Reply Last reply
            0
            • I Imran Khan Pathan

              Hi friends I have bit problem in following line String.Format("{0:t}","11/19/2007 10:00 AM"); I want to get Sort time format:- 10:00 AM Thanks in advance pathan

              GOD HELP THOSE WHO HELP THEMSELVES

              M Offline
              M Offline
              mnvkng76
              wrote on last edited by
              #6

              You need to turn the string to a DateTime value as below: DateTime timetoparse = Convert.ToDateTime("11/19/2007 10:00 AM"); this.textBox1.Text = string.Format("{0:t}", timetoparse); Output = 10:00 AM

              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