This created a dissociation of the calendar month from the lunation. The Julian calendar was no longer dependent on the observation of the new moon but simply followed an algorithm of introducing a leap day every four years. The Roman calendar was reformed by Julius Caesar in 46 BC. This was mostly based on observation, but there may have been early attempts to model the pattern of intercalation algorithmically, as evidenced in the fragmentary 2nd-century Coligny calendar. Ĭalendars in antiquity were lunisolar, depending on the introduction of intercalary months to align the solar and the lunar years. Ī great number of Hellenic calendars developed in Classical Greece, and in the Hellenistic period gave rise to both the ancient Roman calendar and to various Hindu calendars. Ī large number of Ancient Near East calendar systems based on the Babylonian calendar date from the Iron Age, among them the calendar system of the Persian Empire, which in turn gave rise to the Zoroastrian calendar and the Hebrew calendar. According to Yukio Ohashi, the Vedanga calendar in ancient India was based on actual astronomical studies during the Vedic Period, and not derived from other cultures. The Vedic India developed a sophisticated time keeping methodology and calendars for Vedic rituals. The first recorded physical calendars, dependent on the development of writing in the Ancient Near East, are the Bronze Age Egyptian and Sumerian calendars. Nevertheless, the Roman calendar contained remnants of a very ancient pre-Etruscan 10-month solar year. The course of the sun and the moon are the most salient natural, regularly recurring events useful for timekeeping, thus in pre-modern societies worldwide lunation and the year were most commonly used as time units. While (firstDay.get(Calendar.DAY_OF_WEEK) != Calendar.Equinox seen from the astronomic calendar of Pizzo Vento at Fondachelli Fantina, Sicily If you really need to this with, you could probably use something like this (untested): // You really want to do all of this on a "date" basis, without DST messingĬalendar firstDay = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.US) (That's a really odd definition of week-of-year I'd normally use the ISO-8601 definition.) ![]() I would avoid bringing the Java week-of-year into the picture at all - unless you can persuade MongoDB to stop being so broken, somehow. both mongo and java calendar start in different weeks so add 1 to reconcileĬt(Calendar.WEEK_OF_YEAR, number.intValue()+1) Int day = firstDay.get(Calendar.DAY_OF_WEEK) Calendar firstDay = Calendar.getInstance(Locale.US) Would something like the following work always? Assume calendar is another instance of Calendar. Based on the week number, I need to arrive at week start date. Scenario: I am running an aggregation in mongo which returns me a week number. Is there a formula I can use to determine which week number to use to get the week start date. ![]() My question is, adding arbitrary 1 does not solve the problem. For instance, for 2013, mongo's week 1 is actually week 2. ![]() Whereas, Java Calendar's DAY_OF_WEEK returns slightly differently (US Locale). “%U” operator to the strftime standard library function. Preceding the first Sunday of the year are in week 0. Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. Mongodb's $week operator states Takes a date and returns the week of the year as a number between 0 and 53.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |