back to article 'Just give me any old date and I'll make it work' ... said the VB script to the coder

Is it that time of the week again already? You've reached Line Break, our weekly roundup of terrible code you've seen in the wild. Today, we're going to delve into submissions from reader comments rather than the usual postbag. Line Break article comments are such a rich seam of snippets and anecdotes, it would remiss to not …

Page:

  1. Steve Davies 3 Silver badge

    Effing 'Merikans

    with their arse about face way of doing dates.

    The cause of more IT 'DOH!' moments than anything else.

    I worked on a system not that long ago that had THREE yes THREE different date formats in the same message.

    yyyy-MM-dd

    dd-MM-yyyy

    MMM-dd-yy

    What script kiddie thought that one up eh?

    Then their is insitence in usung AM/PM on displays when the rest of the world goes meh and gets on with a 24hr clock.

    1. Anonymous Coward
      Anonymous Coward

      Re: Effing 'Merikans

      Get bent. Not all of us _AMERICAN'S_ (we don't call you "'ritan's" now do we?) use a mm.dd.yy format nor a 12Hour clock. Some of us use a yyyy.mm.dd 24Hour format instead for many reasons. Being a stereotypical twat (calling us a unflattering dimuative & claiming we ALL do something) merely reflects badly upon yourself. Don't be a twat, rise above your bigotry & learn that not all American's are alike, just like all you "Limey Pricks" don't have your head up your ass.

      1. DavCrav

        Re: Effing 'Merikans

        "Get bent. Not all of us _AMERICAN'S_ (we don't call you "'ritan's" now do we?) use a mm.dd.yy format nor a 12Hour clock. Some of us use a yyyy.mm.dd 24Hour format instead for many reasons. Being a stereotypical twat (calling us a unflattering dimuative & claiming we ALL do something) merely reflects badly upon yourself. Don't be a twat, rise above your bigotry & learn that not all American's are alike, just like all you "Limey Pricks" don't have your head up your ass."

        OK, I'll correct his statement: Almost all Americans use mm/dd/yy as their date format. The remaining ones apparently put extra apostrophes in 'Americans'.

        And FYI, the official US system is mm/dd/yy, so it's a bit rich to say that because you personally don't, he's a twat.

        Oh, and by the way, the reason we call you Merkins is that you elected someone, twice, who pronounced your country in that way.

        1. Anonymous Coward
          Anonymous Coward

          Re: Effing 'Merikans

          'Oh, and by the way, the reason we call you Merkins is that you elected someone, twice, who pronounced your country in that way.'

          Well, that and the vaguely amusing association with a pubic wig.

          1. gcla72

            Re: Effing 'Merikans

            Pubic wig? Trump hasn't been elected yet...!

          2. PNGuinn
            Joke

            Re:...vaguely amusing association with a pubic wig.

            But shirley not all 'Septics aspire to be President of the U S of A??

          3. Michael Wojcik Silver badge

            Re: Effing 'Merikans

            Well, that and the vaguely amusing association with a pubic wig.

            Indeed, the contraction 'Merkin as a demonym for a citizen or resident of the USA was widely used on Usenet at least as far back as the early 1990s, presumably well before the individual in question was elected. (It's hard to say for sure to whom the previous poster was referring, since we have many elected officials in the US, and they have displayed a fascinating variety of pronunciations.)

        2. #define INFINITY -1

          My Brevity is Better than Yours

          Whoever thought of using numbers instead of month names?

        3. Indolent Wretch

          Re: Effing 'Merikans

          Surely the point here is it's not that ALL Americans use the month/day arsetitwad or that MOST americans use the month/day arsetitwad or that only SOME Americans use the month/day arsetitwad. The important point is that ONLY Americans use the month/day arsetitwad*

          (Yes, yes I know Belize and Federated States of Micronesia do it that way as well but c'mon).

          1. Prst. V.Jeltz Silver badge

            Re: Effing 'Merikans are closer than us

            obviously the correct format is:

            yyyy/mm/dd

            that way its alphabetical and chronological - and the American format is closer to that than us

            1. Captain Hogwash
              WTF?

              Re: that way its alphabetical and chronological

              Huh?

              1. What_Does_Not_Kill_You_Makes_You_Stronger
                Coat

                Re: that way its alphabetical and chronological

                Capitain Hogwash, you missed that the comment was from a Vogon (See name) and therefore something has obviously been lost in translation. :)

                1. PNGuinn
                  Go

                  Re: that way its alphabetical and chronological @w-d-n-k-y-m-y-s

                  If the comment was from a Vogon it must have been poetic licence, no?

              2. Mark Solaris

                Re: that way its alphabetical and chronological

                He means when you sort it, the dates are displayed in chronological order... because 2016-03-10 is alphabetically (ASCII) greater than 2016-03-09. You can't do that with MM/DD/YYYY, DD/MMM/YYYY etc.

                Using YYYY-MM-DD in log file names is a very useful thing.

            2. Alan Brown Silver badge

              Re: Effing 'Merikans are closer than us

              "that way its alphabetical and chronological - and the American format is closer to that than us"

              FWIW, before being codified as a standard, yyyymmdd was a japanese standard.

              Just as they taught the british how to make motorcycle engines that don't leak oil, they taught the world how to write dates that can't be misinterpreted.

              1. Sgt_Oddball

                Re: Effing 'Merikans are closer than us

                Oh come now, the oil leaks were easy to fix with every packet of cornflakes (use the crankcase with some oil on the edge on the inside, cut out the oil stain and reattach, simples.... Or at least that's what an old biker swore blind did the job).

                As for dates, never trust a none explicit date format, jam it into iso unless your displaying it. Then format to taste.

            3. UKLooney

              Re: Effing 'Merikans are closer than us

              yyyymmdd would be alphabetical, chronological and numerical.

              This is the future!

      2. joeldillon

        Re: Effing 'Merikans

        I'm not seeing that 'Merikan' is any worse than 'Brit' and Americans use that one all the time.

        And I'm pretty sure a vanishingly small proportion of Americans (or anyone else) use the ISO date format day to day.

        1. Shadow Systems

          @Joeldillon, re: dates.

          The U.S. Military uses that format all the time.

          It's just Civilians that tend not to, mores the pity.

          =-J

      3. DiViDeD

        Re: Effing 'Merikans

        " just like all you "Limey Pricks" don't have your head up your ass"

        That's absolutely right!

        WE have our head up our ARSE

    2. Anonymous Coward
      Anonymous Coward

      Not all of them...

      That's why I used to like VAX/VMS - the standard date display format was DD-MON-YYYY,

      It was unambiguous - you couldn't confuse the day with the month (one was a number., the other was text), and you couldn't confuse the year with either of them.

      1. Anonymous Coward
        Anonymous Coward

        Re: Not all of them...

        AC: "That's why I used to like VAX/VMS..."

        I was once asked to start using an application running on VMS, supposed to help generate Functional Test Program 'vectors' based on the circuit board description language. The software package came with a quarter million dollar price tag.

        Within minutes of trying to use it, I was forced instead to start documenting the bugs, as opposed to actually using the software. 30-pages resulted. One observation was three different date formats on one screen. Another bug was reliance on Ctrl-T to perform a key program function, but VMS intercepted this keystroke to display the system Date & Time. Perfect rubbish. Oh, and didn't work, at all.

        Agree that VMS was good. But this $250K software application was (effectively) refunded.

        1. Kubla Cant

          Re: Not all of them...

          On VMS Ctrl-T displays a line of information about the running process, including, IIRC CPU and IO statistics. It's very useful if you think a process might be stalled or looping.

          If you want Ctrl-T to be sent to the program, you can disable this feature with SET NOCONTROL=T.

      2. Schultz

        DD-MON-YYYY

        sucks for sorting dates. I like YYYY-MM-DD -- everything ends up in the right place without any effort.

        1. Mark Solaris

          Re: DD-MON-YYYY

          >Schultz

          >DD-MON-YYYY sucks for sorting dates. I like YYYY-MM-DD -- everything

          >ends up in the right place without any effort.

          How about that, Schultz does actually know something. #tvjoke

        2. Prst. V.Jeltz Silver badge

          Re: DD-MON-YYYY - make your minds up!

          Shultz said

          ". I like YYYY-MM-DD -- everything ends up in the right place without any effort."

          and has 12upvotes

          I said exactly the same and massive downvoting

          is it cos i is green?

          1. Danny 14

            Re: DD-MON-YYYY - make your minds up!

            seconds since epoch. Do what you want to the formatting then.

          2. Charlie Clark Silver badge
            Thumb Down

            Re: DD-MON-YYYY - make your minds up!

            I said exactly the same and massive downvoting

            Nope you said: yyyy/mm/dd

            YYYY-MM-DD is ISO 8601 which is why it gets all the votes. Have another downvote.

          3. PNGuinn
            Pint

            Re: DD-MON-YYYY - make your minds up! @Pr V J

            Yes.

            1. Allan George Dyer

              Re: DD-MON-YYYY - make your minds up! @Pr V J

              All this discussion, and no-one's mentioned the RFC822 date-time standard yet... well-defined, yet a nightmare to use; evil.

              As a public service, the obligatory xkcd:

              https://xkcd.com/1179/

        3. Anonymous Coward
          Anonymous Coward

          Re: DD-MON-YYYY

          You are missing the point.

          For display and entry purposes a date string of DD-MON-YYYY is unambiguous - even in different languages.

          When sorting using the actual date/time value then the internal date/time format will handle the ordering.

          The only problem comes if you insist on trying to do an alpha sort on a text version of the date string. In that case of course you should use YYYY-MM-DD (separaters to taste...).

      3. MiguelC Silver badge

        Re: Not all of them...

        Glad you don't need localization or else you’d have run into problems (Feb is Fev in French, etc.)

        1. Wensleydale Cheese

          Re: Not all of them...

          The first three letters of the month name works in English, but not French.

          Jan, Jan,

          Feb, Fev

          ...

          Jun, Jui

          Jul, Jui -- ooops

        2. PNGuinn
          Trollface

          Re: Not all of them...(Feb is Fev in French)

          Since we seem to be trading insults over the pond, in the interest of being xenophobically inclusive, may I respectfully point out that is the frenchies' problem since they don't speak the Queen's English. (Nor do the 'Merkins for that matter....)

          >>Ducks<<

          1. Anonymous Coward
            Anonymous Coward

            Re: Not all of them...(Feb is Fev in French)

            I genuinely can't think of any relevance for the linked article other than it's hilarious and you mentioned the French.

            http://metro.co.uk/2016/03/16/frenchman-started-fighting-with-cheese-in-waitrose-after-trying-to-steal-it-5756274/

      4. Erebus

        Re: Not all of them...

        "The cause of this problem is a thing called cdate() that lives deep inside the run-time infrastructure"

        Well no, the cause of this problem was the developer not implementing the ISO 8601 date format (which the CDate() function, incidentally, understands perfectly). GIGO.

    3. Anonymous Coward
      Anonymous Coward

      Re: Effing 'Merikans

      SD "...their is insitence in usung..."

      At least 80% of the words in this extract are incorrect in some way.

    4. Alan Brown Silver badge

      Re: Effing 'Merikans

      The only standard date format is yyyymmdd:hhmmss (for storing dates)

      The way it's displayed should be derived from locale. If you must use other formats they should be interpreted according to locale and stored as above.

      Personally, if stuff is on paper I always use MMM to remove any abiguous interpretations.

      1. Androgynous Cupboard Silver badge

        Re: Effing 'Merikans

        ISO8601 or GTFO

      2. Wensleydale Cheese

        Re: Effing 'Merikans

        "The only standard date format is yyyymmdd:hhmmss (for storing dates)"

        You forgot the time zone or offset from UTC

        And for human readability it's better with dashes, No colons in the time field when used as part of filenames please - that causes cross-platform problems.

        /pedant

        1. lowwall

          Re: Effing 'Merikans

          Time Zones and offsets occasionally need to be forgotten. Thanks to a 12-year-old GnuCash bug, if I allow my work computer to use a time zone that has daylight savings time, my transaction dates all shift twice a year. If anyone would like to fix this, here's the bug report: https://bugzilla.gnome.org/show_bug.cgi?id=137017

      3. JeffyPoooh
        Pint

        Re: Effing 'Merikans

        AB "The only standard date format is..."

        'The nice thing about standards is that there are so many from which to choose.'

        The phrase "The only standard date format is..." is clearly nonsense.

      4. Michael Wojcik Silver badge

        Re: Effing 'Merikans

        The only standard date format is yyyymmdd:hhmmss

        I have no idea what "standard" you're referring to, but ISO 8601 uses "T" as the separator between the date and time, not a colon.

    5. Dan 55 Silver badge

      Re: Effing 'Merikans

      The way Access DB files, VBScript, Jet, IIS, and Windows locale work together to confuse dates is incredible. At least the planets align themselves every so often, you need to pointlessly twiddle settings for hours until they all deign to use YYYY-MM-DD.

    6. Anonymous Noel Coward

      Re: Effing 'Merikans

      Japanese also do mm/dd/yyyy.

      That being said, I do use American dates when naming files, as it helps order them better, rather than having the day order everything in an arbitrary way. E.g. 01.04.2016, 07.12.2016, 16.03.2016...

      1. Frumious Bandersnatch

        Re: Effing 'Merikans

        Japanese also do mm/dd/yyyy.

        [Citation needed]

        1. Chairo

          Re: Effing 'Merikans

          Japanese also do mm/dd/yyyy.

          [Citation needed]

          In official documents Japanese dates are stated as EEYY年MM月DD日, with EE being the epoch. Currently we are in "平成 = heisei" Epoch, year 28.

          Ups, my driving licence needs to be renewed until 平成28年10月28日. Still a few months to go, but good I checked...

          In less official documents the Gregorian calender year might be used, but no self respecting Japanese public officer would voluntary relapse to something so mundane.

          Oh, and each epoch starts and ends with the death/inthronation of a new emperor, so some years have two epochs.

          Oh, and sometimes you have to enter the numbers as double byte and sometimes as single byte. Filling in a web form in Japanese can be very frustrating, indeed.

          Regarding [Citation needed] - you can check it up in Wikipedia. Not that Wikipedia is any good as a reference.

          Nothing is ever simple in Japan...

  2. John Robson Silver badge

    I assumed everyone here had heard of...

    The Daily WTF

    1. Michael Wojcik Silver badge

      Re: I assumed everyone here had heard of...

      Sadly, TDWTF is much diminished from its glory days. There are too many editors, and they do far too much editing: submissions are mangled into awkward narratives that are often over-long, stylistically tone-deaf, and (worst of all) technically inaccurate.

      And Discourse is an abysmal commenting system. It's an ideologically-grounded writing environment created by sophomoric technophiles who haven't bothered to study either the theory of writing or any actual research on it, as far as I can tell.

  3. Bc1609

    VBA date handling has taken at least five years off my lifespan

    Eventually I gave in and wrote my own date-handling function - a CDate replacement - which I've tried to make the company standard. It taught me a lot about string handling, though, and all the weird stuff associated with dates and calendars that you almost never see or hear of unless you're a programmer. For example, did you know that in Shanghai the time "1927-12-31 23:54:08" actually happened twice? And that Java will bug out in weird ways if you're using the Shanghai timezone as a result? I didn't. Another fun teaser: why does the UK tax year start on 5th April?

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon