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. Date

Date

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

    Difference between two dates .(MM/DD/YY) One date is given through Textbox are in the same format as System date. Other is just system date . I want to get date,month,year differences

    L P 2 Replies Last reply
    0
    • S simworld

      Difference between two dates .(MM/DD/YY) One date is given through Textbox are in the same format as System date. Other is just system date . I want to get date,month,year differences

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The right way to do this is by converting to two DateTime objects, then apply whatever it is you need, e.g. subtract to get a TimeSpan. You should not operate on date strings yourself, use TryParse() instead. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


      1 Reply Last reply
      0
      • S simworld

        Difference between two dates .(MM/DD/YY) One date is given through Textbox are in the same format as System date. Other is just system date . I want to get date,month,year differences

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

        What Luc said, plus: Don't use TextBoxes for dates, use a DateTimePicker. Use ISO 8601-compliant formats -- YYYY-MM-DD.

        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