Date comparison does not work correctly??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lloyd Sheen

    Date comparison does not work correctly??

    Below is the output from command window. This shows values of variables and
    result of comparison.

    Make no sense except to dot.net.

    Any ideas??

    ?pofile
    #11/11/2003 12:39:22 PM#
    ?pdtdbdate
    #11/11/2003 12:39:22 PM#
    ?pofile=pdtdbda te
    False

    Lloyd Sheen



  • emg

    #2
    Re: Date comparison does not work correctly??

    It's possible that the display format lacks the same level of precision as
    the actual variables. In other words, var1 may have hours, minutes, seconds
    and hundreths of seconds while var2 either doesn't have hundredths of
    seconds (:00) or the hundredths value differs.


    "Lloyd Sheen" <sqlguyremoveal lofthis@tostops pamhotmail.com> wrote in message
    news:dU8Rb.2053 1$Vk2.2221@news 01.bloor.is.net .cable.rogers.c om...[color=blue]
    > Below is the output from command window. This shows values of variables[/color]
    and[color=blue]
    > result of comparison.
    >
    > Make no sense except to dot.net.
    >
    > Any ideas??
    >
    > ?pofile
    > #11/11/2003 12:39:22 PM#
    > ?pdtdbdate
    > #11/11/2003 12:39:22 PM#
    > ?pofile=pdtdbda te
    > False
    >
    > Lloyd Sheen
    >
    >
    >[/color]


    Comment

    • Lloyd Sheen

      #3
      Re: Date comparison does not work correctly??

      Full path of the date is -
      1. Scan all files in several folders
      2. Store date of last change in SQL Server
      3. Retrieve date from SQL Server and compare to last change date of file

      It is so hard to believe that data-in is not equal to data-out.

      With dot.net everything that should be simple (at least according to MS) is
      not.

      Lloyd Sheen
      "emg" <emg no spam@comcast.ne t> wrote in message
      news:%23Ms6EaB5 DHA.2776@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > It's possible that the display format lacks the same level of precision as
      > the actual variables. In other words, var1 may have hours, minutes,[/color]
      seconds[color=blue]
      > and hundreths of seconds while var2 either doesn't have hundredths of
      > seconds (:00) or the hundredths value differs.
      >
      >
      > "Lloyd Sheen" <sqlguyremoveal lofthis@tostops pamhotmail.com> wrote in[/color]
      message[color=blue]
      > news:dU8Rb.2053 1$Vk2.2221@news 01.bloor.is.net .cable.rogers.c om...[color=green]
      > > Below is the output from command window. This shows values of variables[/color]
      > and[color=green]
      > > result of comparison.
      > >
      > > Make no sense except to dot.net.
      > >
      > > Any ideas??
      > >
      > > ?pofile
      > > #11/11/2003 12:39:22 PM#
      > > ?pdtdbdate
      > > #11/11/2003 12:39:22 PM#
      > > ?pofile=pdtdbda te
      > > False
      > >
      > > Lloyd Sheen
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • emg

        #4
        Re: Date comparison does not work correctly??

        You're assuming too much. You're reading in a timestamp from a file system,
        storing it into a variable, passing it to SQL and storing it in a database.
        Have you looked at the value:
        a) on the file system
        b) once it's in your .Net variable
        c) once you've passed it to SQL (is it a stored procedure with a datetime
        data type? a string datatype? or a straight SQL statement?
        d) stored it in a sql variable (again, a dateTime? a smallDateTime? a
        string?)

        I've had problems in web pages passing dates back to SQL and losing
        precision. It's not just "dotnet", it's the file system, dotnet and SQL all
        passing data back and forth. This may not be the source of your problem but
        I would certainly look at it more closely.


        "Lloyd Sheen" <sqlguyremoveal lofthis@tostops pamhotmail.com> wrote in message
        news:co9Rb.4177 1$iLV.33841@twi ster01.bloor.is .net.cable.roge rs.com...[color=blue]
        > Full path of the date is -
        > 1. Scan all files in several folders
        > 2. Store date of last change in SQL Server
        > 3. Retrieve date from SQL Server and compare to last change date of file
        >
        > It is so hard to believe that data-in is not equal to data-out.
        >
        > With dot.net everything that should be simple (at least according to MS)[/color]
        is[color=blue]
        > not.
        >
        > Lloyd Sheen
        > "emg" <emg no spam@comcast.ne t> wrote in message
        > news:%23Ms6EaB5 DHA.2776@TK2MSF TNGP09.phx.gbl. ..[color=green]
        > > It's possible that the display format lacks the same level of precision[/color][/color]
        as[color=blue][color=green]
        > > the actual variables. In other words, var1 may have hours, minutes,[/color]
        > seconds[color=green]
        > > and hundreths of seconds while var2 either doesn't have hundredths of
        > > seconds (:00) or the hundredths value differs.
        > >
        > >
        > > "Lloyd Sheen" <sqlguyremoveal lofthis@tostops pamhotmail.com> wrote in[/color]
        > message[color=green]
        > > news:dU8Rb.2053 1$Vk2.2221@news 01.bloor.is.net .cable.rogers.c om...[color=darkred]
        > > > Below is the output from command window. This shows values of[/color][/color][/color]
        variables[color=blue][color=green]
        > > and[color=darkred]
        > > > result of comparison.
        > > >
        > > > Make no sense except to dot.net.
        > > >
        > > > Any ideas??
        > > >
        > > > ?pofile
        > > > #11/11/2003 12:39:22 PM#
        > > > ?pdtdbdate
        > > > #11/11/2003 12:39:22 PM#
        > > > ?pofile=pdtdbda te
        > > > False
        > > >
        > > > Lloyd Sheen
        > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Cor

          #5
          Re: Date comparison does not work correctly??

          Hi Lloyd,

          Why you make it us so difficult to help you.

          Now you are talking that it is about two different kinds of dataformats that
          was the date comparissing about.

          While I could not understand what could wrong, because you first presenting
          it as strings or at least the same dataformats.

          Do you have more hidden things in your solution from which we hear
          afterwards?

          Just my thoughts,

          Cor



          Comment

          • Mark Jerde

            #6
            Re: Date comparison does not work correctly??

            Lloyd Sheen wrote:
            [color=blue]
            > Any ideas??[/color]

            Compare them as strings? <g>

            -- Mark


            Comment

            • Lloyd Sheen

              #7
              Re: Date comparison does not work correctly??

              That is what I ended up doing. If I check as poFile.ToString then there is
              no problem.

              "Mark Jerde" <mark.jerde@ver izon.no.spam.ne t> wrote in message
              news:uf2JTtB5DH A.2480@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Lloyd Sheen wrote:
              >[color=green]
              > > Any ideas??[/color]
              >
              > Compare them as strings? <g>
              >
              > -- Mark
              >
              >[/color]


              Comment

              • Lloyd Sheen

                #8
                Re: Date comparison does not work correctly??

                No hidden things. As in next post, comparing as strings fixes the problem.
                It would be nice if data in matched the data out.

                I am getting a value from System.IO for last updated time and storing it in
                SQL Server. When I retrieve it to compare against the original (in most
                cases) it is not the same. This is the problem. This kinda takes away from
                the idea that what I store can be retrieved later and used to determine
                processing paths.

                I apologize if you think I am difficult. I just spent a weekend working
                (fighting) with the IDE and all these problems do not help. What was a
                simple implementation conceptually ends up taking twice the time and way too
                many workarounds for me.

                I appreciate all the help others give and if you notice I have answered
                postings when I know the answer or a workaround.

                Lloyd Sheen

                "Cor" <non@non.com> wrote in message
                news:%23sd6wmB5 DHA.2064@TK2MSF TNGP11.phx.gbl. ..[color=blue]
                > Hi Lloyd,
                >
                > Why you make it us so difficult to help you.
                >
                > Now you are talking that it is about two different kinds of dataformats[/color]
                that[color=blue]
                > was the date comparissing about.
                >
                > While I could not understand what could wrong, because you first[/color]
                presenting[color=blue]
                > it as strings or at least the same dataformats.
                >
                > Do you have more hidden things in your solution from which we hear
                > afterwards?
                >
                > Just my thoughts,
                >
                > Cor
                >
                >
                >[/color]


                Comment

                • Cor

                  #9
                  Re: Date comparison does not work correctly??

                  Hi Sean,

                  Thanks for your answer,

                  But different dateformats is not only a Net item.
                  There is almost always a data difference between a value stored on a disk
                  than in memory.

                  Only comparible types makes it posible to compare and therefore I was
                  thinking you was doing that by first converting the value's to date's (while
                  strings is even better and even more better strings which are trimmed on
                  both sides).

                  I was thinking on your question, did not understand why it went wrong, but
                  never thought about the idea that you where talking about data in different
                  data types.

                  And therefore I was not happy with your answer in the style if it was the
                  fault of others.

                  But no hard feeling, with this answer from you I will not ignore you nex
                  time when you have a question and help you if I can.

                  Cor
                  [color=blue]
                  > No hidden things. As in next post, comparing as strings fixes the[/color]
                  problem.[color=blue]
                  > It would be nice if data in matched the data out.
                  >
                  > I am getting a value from System.IO for last updated time and storing it[/color]
                  in[color=blue]
                  > SQL Server. When I retrieve it to compare against the original (in most
                  > cases) it is not the same. This is the problem. This kinda takes away[/color]
                  from[color=blue]
                  > the idea that what I store can be retrieved later and used to determine
                  > processing paths.
                  >
                  > I apologize if you think I am difficult. I just spent a weekend working
                  > (fighting) with the IDE and all these problems do not help. What was a
                  > simple implementation conceptually ends up taking twice the time and way[/color]
                  too[color=blue]
                  > many workarounds for me.
                  >
                  > I appreciate all the help others give and if you notice I have answered
                  > postings when I know the answer or a workaround.
                  >[/color]


                  Comment

                  Working...