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. Checking DateTimePicker date is => today's date?

Checking DateTimePicker date is => today's date?

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

    How can I check to see if the selected date in a DateTimePicker is a date which is future to the current date (now) please?

    A G H M 4 Replies Last reply
    0
    • K kanchoette

      How can I check to see if the selected date in a DateTimePicker is a date which is future to the current date (now) please?

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Compare it to DateTime.Today().

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • K kanchoette

        How can I check to see if the selected date in a DateTimePicker is a date which is future to the current date (now) please?

        G Offline
        G Offline
        Giorgi Dalakishvili
        wrote on last edited by
        #3

        You can use DateTime.Now to retrieve current date and time. DateTimePicker has a Value property so you can compare these values.

        Giorgi Dalakishvili #region signature My Articles / My Latest Article[^] / My blog[^] #endregion

        1 Reply Last reply
        0
        • K kanchoette

          How can I check to see if the selected date in a DateTimePicker is a date which is future to the current date (now) please?

          H Offline
          H Offline
          HemJoshi
          wrote on last edited by
          #4

          if(dateTimePicker1.Value>DateTime.Now) { MessageBox.Show("Greater"); }

          1 Reply Last reply
          0
          • K kanchoette

            How can I check to see if the selected date in a DateTimePicker is a date which is future to the current date (now) please?

            M Offline
            M Offline
            mark_w_
            wrote on last edited by
            #5
                   if( DateTime.Compare(DateTime.Now, dateTimePicker1.Value) <=0)
                    {
                    // do stuff
                    }
            
            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