• Jibble (unregistered) in reply to It'sMeMario
    It'sMeMario:
    The real WTF is that he could use only one method:

    public Date getDateInWeek(Date in, int desiredDay) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(in); return new Date(in.getTime() + (desiredDay - gc.get(Calendar.DAY_OF_WEEK))243600*1000); }

    What happened to "throw new IllegalArgumentException("unknown desired day: "+desiredDay);"?

  • JJ (unregistered) in reply to Figs
    Figs:
    And in German samstag = Saturday, Sonntag (note the capital S) = Sunday (literally).
    All days in German are capitalized*. It has nothing to do with Jesus.

    *In fact, with very few exceptions, all nouns are capitalized.

  • jay (unregistered)

    Wow, are we really debating what the first day of the week is?

    Find a calendar. Like this one, for example: http://www.timeanddate.com/calendar/ You will see that they show the days grouped into months, and within months grouped into weeks. In a typical format, there is one line for each week, with the days of the week written across the top, in order.

    Now look carefully. Which day is first? Hmm, that would be "Sunday". Which is last? "Saturday".

    I suppose if you search enough you can find calendars with some other arrangement. But this would be the exception. 95+% of calendars show the week beginning with Sunday.

    Study the history. Sunday has routinely been understood to be the first day of the week for thousands of years. At least for as long as we have had the word "Sunday".

  • jay (unregistered) in reply to Proud Graduate April 2013
    Proud Graduate April 2013:
    Shinobu:
    Why is it that date handling code, which is notoriously easy to screw up, is such a favourite target for reinvention by beginner programmers?
    because dates should be easy (I been using them since I was about 3), yet all the available libraries seem unnecessarily complex when I want to program with them.

    I have a degree. I must be able to make a nice simple date thingummy to do what I want

    switch you sarcasm detector on

    That's why I think we should totally reform the calendar and replace it with something simple and regular. Why are the months different lengths? Why are some years one day longer than others? And then to add to the craziness, somebody came up with daylight savings time so two days per year are not 24 hours. And if you want to get really crazy, you have those insane people who want to add leap seconds every now and then. Yeah, that makes for a good, convenient time-keeping system.

    Here's my suggestion: We have 13 months per year. Each month has exactly 4 7-day weeks, or 28 days. All days are 24 hours long. The first of every month is a Sunday. Period.

    Think of the advantages. With all months the same length, you wouldn't have to remember silly rhymes like "30 days hath September" or however you keep track of this. No complex leap-year rules either. Date arithmetic would be simple.

    Yes yes, I'm sure someone will say that my calendar would be wrong because it has only 364 days in a year while a year is actually 365-point-something days. To which I reply: Where is it written that a calendar year must exactly match the time it takes the Earth to travel around the sun? Our calendar doesn't exactly match it now: it just approximates it. What disasters would occur if we had a less-close approximation that gave us a simpler and easier to manage calendar? So the seasons would not always start on the same date every year. So what? In practical terms, just because the winter solstice occurs on Dec 22 doesn't mean that winter weather begins on that date, like it's always a comfortable temperature outdoors on Dec 21 but freezing cold and snowing on Dec 23. So over the course of your lifetime, the start of winter would move a couple of months. So what? I think it would be less hassle to keep track of a changing date for the start of the seasons then all the messiness we put up with in our present calendar.

  • p (unregistered) in reply to jay
    jay:
    Wow, are we really debating what the first day of the week is?

    Find a calendar. Like this one, for example: http://www.timeanddate.com/calendar/

    ...or like this one: http://www.kalender.se/
    jay:
    Now look carefully. Which day is first?
    Monday, of course, as in all calendars where I live.
    jay:
    95+% of calendars show the week beginning with Sunday.
    Probably – of those produced where the week starts on Sunday. On the other hand, calendars produced where the week starts on Monday generally start on Monday. So what?
  • p (unregistered) in reply to Tractor
    Tractor:
    While I appreciate the usefulness of calendars and agendas considering Sunday the first day of the week, [...]
    Could you elaborate on why this is useful, for those of us lacking experience with weeks starting on Sunday?
  • (cs) in reply to jay
    jay:
    Find a calendar. Like this one, for example: http://www.timeanddate.com/calendar/ You will see that they show the days grouped into months, and within months grouped into weeks. In a typical format, there is one line for each week, with the days of the week written across the top, in order.

    Now look carefully. Which day is first? Hmm, that would be "Sunday". Which is last? "Saturday".

    Except it isn't. If you had actually looked at the link you posted, you would have seen that the calendar shows Monday as the first day, as is the international standard. Of course, except if you live in the US, or another country that ignores international standards, in which case it helpfully localises its calendar to your local traditions.

  • CoyPu (unregistered) in reply to briverymouse
    briverymouse:
    jay:
    Find a calendar. Like this one, for example: http://www.timeanddate.com/calendar/ You will see that they show the days grouped into months, and within months grouped into weeks. In a typical format, there is one line for each week, with the days of the week written across the top, in order.

    Now look carefully. Which day is first? Hmm, that would be "Sunday". Which is last? "Saturday".

    Except it isn't. If you had actually looked at the link you posted, you would have seen that the calendar shows Monday as the first day, as is the international standard. Of course, except if you live in the US, or another country that ignores international standards, in which case it helpfully localises its calendar to your local traditions.

    I guess the site checks the ip address of the client to choose the settings for the clients setting. it is possile to hange the seting on the pag

Leave a comment on “Nine Ways to Tuesday”

Log In or post as a guest

Replying to comment #:

« Return to Article