Results 1 to 3 of 3

Thread: Christmas is greater than Christmas? W3C Date Comparison

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Question Christmas is greater than Christmas? W3C Date Comparison

    Looking at the XQuery/XPath specifications, it says

    op:date-greater-than(xs:date("2004-12-25Z"), xs:date("2004-12-25+07:00")) returns true.

    op:date-greater-than(xs:date("2004-12-25-12:00"), xs:date("2004-12-26+12:00")) returns false.
    To put this in a polite way, it seems to be rather idiotic. When comparing two dates, the time zone or the time should not factor into anything. To stick with these standards means that when I compare two dates 'given' in an ISO format from 'wherever', I need to perform string manipulations to ensure that there are no Zulu or Time-Zones appended to the date. To imply that Christmas in Cambodia is 'less than' Christmas in the UK does not make sense. They're both December 25, and such a comparison would be valid if we were comparing times.

    What's the logical reasoning behind this specification? Please don't reply in a manner to give W3C the benefit of the doubt, simply because they may be infallible to you.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Christmas is greater than Christmas? W3C Date Comparison

    Well they are different dates. You're including the time, therefore it's comparing the time. Why wouldn't it compare both the date and time if you are including both?
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Christmas is greater than Christmas? W3C Date Comparison

    The format is such that it makes use of a timezone, those aren't actually times, for reasons that make me

    Why they get included escapes me, but the way I see it, a data type should represent... well, what it says on the box.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width