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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. DateTime Compare Problem

DateTime Compare Problem

Scheduled Pinned Locked Moved C#
databasequestioncsharphelptutorial
4 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.
  • D Offline
    D Offline
    dataminers
    wrote on last edited by
    #1

    I have sql query in C# SELECT Last_Date FROM MYTABLE WHERE Last_Date > CONVERT(DATETIME, '13.11.2007 22:43:50', 103) Note: Last_Date column data type is datetime Example; If my Last_Date column like this 13.11.2007 22:43:49 13.11.2007 22:43:50 13.11.2007 22:43:51 So this query return this values 13.11.2007 22:43:50 13.11.2007 22:43:51 If I change ">" operator to ">=" operator, result is same. How can I eleminate "13.11.2007 22:43:50" value? I want to get greater than (">") values. Thanks..

    C B 2 Replies Last reply
    0
    • D dataminers

      I have sql query in C# SELECT Last_Date FROM MYTABLE WHERE Last_Date > CONVERT(DATETIME, '13.11.2007 22:43:50', 103) Note: Last_Date column data type is datetime Example; If my Last_Date column like this 13.11.2007 22:43:49 13.11.2007 22:43:50 13.11.2007 22:43:51 So this query return this values 13.11.2007 22:43:50 13.11.2007 22:43:51 If I change ">" operator to ">=" operator, result is same. How can I eleminate "13.11.2007 22:43:50" value? I want to get greater than (">") values. Thanks..

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      There is a micro second component, I believe. Try 22:43:50.999

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      D 1 Reply Last reply
      0
      • C Christian Graus

        There is a micro second component, I believe. Try 22:43:50.999

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        D Offline
        D Offline
        dataminers
        wrote on last edited by
        #3

        Yes, its true. I know but how can I solve my problem. I think this is related about style code "103". But I don't know which style code is correct my problem. I search but I can't find.

        1 Reply Last reply
        0
        • D dataminers

          I have sql query in C# SELECT Last_Date FROM MYTABLE WHERE Last_Date > CONVERT(DATETIME, '13.11.2007 22:43:50', 103) Note: Last_Date column data type is datetime Example; If my Last_Date column like this 13.11.2007 22:43:49 13.11.2007 22:43:50 13.11.2007 22:43:51 So this query return this values 13.11.2007 22:43:50 13.11.2007 22:43:51 If I change ">" operator to ">=" operator, result is same. How can I eleminate "13.11.2007 22:43:50" value? I want to get greater than (">") values. Thanks..

          B Offline
          B Offline
          Bino B
          wrote on last edited by
          #4

          First of all what u need to do AFAIK is to split the datetime into three parts lik date,time and am/pm. then put the checking.this will fetch u the xact result.

          Cheers Bino www.codepal.co.nr

          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