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. Remove the time part in record access

Remove the time part in record access

Scheduled Pinned Locked Moved C#
question
8 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.
  • J Offline
    J Offline
    juliogyn
    wrote on last edited by
    #1

    I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

    textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

    But not resolved.

    L M W C 5 Replies Last reply
    0
    • J juliogyn

      I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

      textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

      But not resolved.

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

      What does "not resolved" mean? Did it display a time-part in the textbox? Or are you trying to remove it from the database itself?

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      J 1 Reply Last reply
      0
      • L Lost User

        What does "not resolved" mean? Did it display a time-part in the textbox? Or are you trying to remove it from the database itself?

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        J Offline
        J Offline
        juliogyn
        wrote on last edited by
        #3

        the time-part does not remove ! :(

        1 Reply Last reply
        0
        • J juliogyn

          I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

          textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

          But not resolved.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          As Eddy has said, your explanation is not very clear! Your use of stringformat indicates you are trying to display a datetime - what you have will work for the display. If you are then storing the value in a datetime field in database it MUST always have a time component and will be 00:00:00 for that format. You can use the Date format in SQL Server but that is a relatively new data type. NEVER store dates as strings.

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          • J juliogyn

            I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

            textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

            But not resolved.

            W Offline
            W Offline
            wthwinner
            wrote on last edited by
            #5

            youtextnox_1.text = DateTime.Parse(field).ToString("MM/dd/yyyy");

            J 1 Reply Last reply
            0
            • J juliogyn

              I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

              textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

              But not resolved.

              W Offline
              W Offline
              wthwinner
              wrote on last edited by
              #6

              textnox_1.text = DateTime.Pares(field).ToString("MM/dd/yyyy");

              1 Reply Last reply
              0
              • J juliogyn

                I am selecting the date field in the table contained in the access, but registration is with the time part. 21/08/2013 00:00:00 How can i do, for remove 00:00:00 parts ?! I tried:

                textnox_1.text = String.Format("{0:MM/dd/yyyy}",field);

                But not resolved.

                C Offline
                C Offline
                CodeBlack
                wrote on last edited by
                #7

                You can use as mentioned below :

                textnox_1.text = field.ToString("MM/dd/yyyy");

                Note : DataType of the field should be datetime. otherwise you will have to convert it to DateTime.

                Regards, CodeBlack

                1 Reply Last reply
                0
                • W wthwinner

                  youtextnox_1.text = DateTime.Parse(field).ToString("MM/dd/yyyy");

                  J Offline
                  J Offline
                  juliogyn
                  wrote on last edited by
                  #8

                  Tanks man, resolved.

                  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