• Anonymous JboPre (unregistered) in reply to pscs
    pscs:
    Anonymous JboPre:
    (Aligning it to the seven-day week as well will be trickier....)
    Why do we need a seven day week?

    That's a religious thing as well.

    NB - Not just Pentateuch based religions, but others as well - seven days a week is probably because (a) there are seven visible heavenly bodies which move across the sky (see the names of the days of the week which are based on their names), and (b) the phases of the moon last seven days. (You can juggle with cause/effect to please whatever your religious beliefs are:) )

    I'm just going by precedent--the seven day week predates both the Julian and Gregorian calendars and is provably unbroken back to at least AD 79. (There's graffiti in Pompeii which lists a day/date pair which matches the current cycle, modulo various details.) It's the main thing that's gotten in the way of modern calendar reform efforts--365~1 mod 7, which means that the ultimate goal of having only one, endlessly reusable calendar will require either moving the Earth or breaking the week cycle, and people seem pretty attached to the week cycle, being historically perfectly willing to change the year count or the year boundary, or even to drop days.

    As for its origins, yes, it pretty clearly comes from the "planets" (quotes as the Greek definition of the word, which includes the Sun and Moon, is required here). It goes back at least to Ptolemaic Egypt, and possibly all the way back to Babylon.

  • Hexatron (unregistered)

    I know it's late, but this wtf inspired me today in sql (MS sqlserver): if datepart(d,@time1) <> datepart(d,@time2) .... to tell if the interval @time1 @time2 straddles midnight

  • Arioch (unregistered) in reply to MrsPost

    [quote user="MrsPost There's ever only going to be one time when the singular is used [/quote]

    Because that code uses pre-assumption, that English is th only language. Be it proper i18sed, you'd have to care, for example, for Russian.

    One form is used for 1, 21, 31...91 Second form is used for 2-4, 22-24, 32-34.. Plural is used for the rest and for 11-19.

    Hundreds are irrelevant, at least cannot find counter-examples.

    So, as of equal opportunities and world-wide politcorrectness, this site was caught redhanded, uc :-)

  • (cs)

    I'd guess it's derived from a technique to find out if a date is the last day of the month, by checking if the following day is in a different month.

    Maybe he knows something we dont? Like "them" making dates metric?

  • (cs) in reply to Pim
    Pim:
    codemanque:
    This looks like a Y2K bug check. I've seen it done before. Get the end of this year, add one and get the new year. If the computer suffers the Y2K bug in that particular piece of software (or maybe the BIOS), and it happens to be 31/12/1999, the new year might be 2000, or it might be 100, or 00. Subtracting one will obvious then give a different result, thus confirming Y2K non-compliance.
    No, sorry, checking form Y2K compliance isn't always that easy. If the next year is 100, as in your example, subtracting 1 will result in 99, but that won't be flagged as an error, because the current year will be 99!

    Erm ... if you're flagging the year as "correct" because it's 99 then you've just succumbed to the Y2K bug in your Y2K bug checker. 4 digit years only! Well, until 9999 ...

    Anyway, I never said it was an effective check. Just that I'd seen it done this way before :)

  • Yragael (unregistered)

    What if first day of decembre is 0, not 1 ? Last day of december won't be 31, but 30... So not only this code is future-proof, it's also platform independant :)

  • anonymous coward (unregistered)

    TRWTF is anyone thinking they "had good reasons for choosing VB".

    VB is not a language intended for serious use.

  • kopnitski (unregistered) in reply to operagost
    operagost:
    MrsPost:
    CaptainSmartass:
    TRWTF on the page today is the job ad for a "Christian professional Senior Systems Engineer". If someone is good at their job, what does it matter what their religion is?
    It's like the various businesses that have the Christian fish symbol. I take it as a warning, kind of like the "Intel Inside" stickers.
    What's the warning sign for internet trolls?

    goatse !

  • NOPIK (unregistered)

    BTW according to VB documentation, date representation, that can be assigned to Date type relies on local settings. So, 12/31/01 can be also 31/12/01 and 01/12/31

  • Tim (unregistered) in reply to Ross Presser

    When the bug ticket comes in, just ignore it for 24 hours and then you don't have to fix it.

  • he forgot judgement day (unregistered)

    there is no day after the very last one - so he forgot the null check!

  • Kendall F. (unregistered)

    TRWTF is choosing VB over C.

  • (cs)

    That is actually a trick I use in T-SQL fairly often. Given a datetime value which is 01/MM/YYYY, you can just do "datetimevar - 1" to get the last day of the previous month because internally a date is an int. Sure, you could use the longer (better documented) dateadd(dd, datevar, -1), function but I prefer the former shorthand way. I do comment in WTF the -1 is doing though for the uninitiated.

Leave a comment on “Foolproof Future-Proofing”

Log In or post as a guest

Replying to comment #:

« Return to Article