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. How to remove the seconds from DatetimePicker ????

How to remove the seconds from DatetimePicker ????

Scheduled Pinned Locked Moved C#
helptutorialquestion
5 Posts 4 Posters 1 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

    I using datetimepicker and when i get the value that the user was choose i get the time with seconds. This field is read only and i can do "get" but i cant do "set". My problem is that i want to drop this seconds and i don't know how. I try to avoid of create new DateTime object and with i parser this object to set the seconds to be "00". Thanks.

    P R 2 Replies Last reply
    0
    • L Lost User

      I using datetimepicker and when i get the value that the user was choose i get the time with seconds. This field is read only and i can do "get" but i cant do "set". My problem is that i want to drop this seconds and i don't know how. I try to avoid of create new DateTime object and with i parser this object to set the seconds to be "00". Thanks.

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Use a CustomFormat.

      1 Reply Last reply
      0
      • L Lost User

        I using datetimepicker and when i get the value that the user was choose i get the time with seconds. This field is read only and i can do "get" but i cant do "set". My problem is that i want to drop this seconds and i don't know how. I try to avoid of create new DateTime object and with i parser this object to set the seconds to be "00". Thanks.

        R Offline
        R Offline
        Riaan Booyzen
        wrote on last edited by
        #3

        It depends on the specific control, but generally the format would be somthing like hh:mm....the default is hh:mm:ss, so drop the ss for dropping the seconds from displaying.

        L 1 Reply Last reply
        0
        • R Riaan Booyzen

          It depends on the specific control, but generally the format would be somthing like hh:mm....the default is hh:mm:ss, so drop the ss for dropping the seconds from displaying.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I already done it. But still, when i do this: DateTime t = DatetimePicker.Value; ==> the t.seconds is not 0. I need that the t.seconds will be always 0.

          A 1 Reply Last reply
          0
          • L Lost User

            I already done it. But still, when i do this: DateTime t = DatetimePicker.Value; ==> the t.seconds is not 0. I need that the t.seconds will be always 0.

            A Offline
            A Offline
            arnepop
            wrote on last edited by
            #5

            dateTimePicker1.Value=dateTimePicker1.Value.AddSeconds(dateTimePicker1.Value.Second*-1);

            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