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. DateTime Conversion

DateTime Conversion

Scheduled Pinned Locked Moved C#
help
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.
  • C Offline
    C Offline
    ChennaiBabu
    wrote on last edited by
    #1

    Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu

    Babu

    S P K 3 Replies Last reply
    0
    • C ChennaiBabu

      Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu

      Babu

      S Offline
      S Offline
      SeMartens
      wrote on last edited by
      #2

      Hi, use txtBookDate.Text = dat.Date.ToString("MM/dd/yyyy"); to show date without the time component. Regards Sebastian

      1 Reply Last reply
      0
      • C ChennaiBabu

        Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu

        Babu

        P Offline
        P Offline
        Paul Brower
        wrote on last edited by
        #3

        Or you can use: txtBookDate.Text = dat.ToShortDateString() ;

        1 Reply Last reply
        0
        • C ChennaiBabu

          Hi All, Greetings.In one of my application i'm using 2 text boxes for displaying date and time respectively.i'm using the following code. DateTime dat = DateTime.Now; txtBookDate.Text = dat.Date.ToString(); txtBookTime.Text = dat.TimeOfDay.ToString(); But the DATE TEXT BOX displying the o/p as 07/12/2006 12:00:00 AM.But i need to display only the date.Can any one help me to correst it.I've tried with some keywords.So reply me ASAP. Reagrds Babu

          Babu

          K Offline
          K Offline
          Khawar Abbas1
          wrote on last edited by
          #4

          Man try this ............................................... DateTime dat = DateTime.Now; txtBookDate.Text = dat.ToShortDateString(); txtBookTime.Text = dat.ToShortTimeString();

          Do good and have good.

          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