incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 120390] New: Function MONTH gives wrong result for many dates prior to October 1582
Date Fri, 27 Jul 2012 13:53:54 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=120390

          Priority: P3
            Bug ID: 120390
          Assignee: ooo-issues@incubator.apache.org
           Summary: Function MONTH gives wrong result for many dates prior
                    to October 1582
          Severity: normal
        Issue Type: DEFECT
    Classification: Application
                OS: All
          Reporter: jes@martnet.com
          Hardware: All
            Status: UNCONFIRMED
           Version: AOO 3.4.0
         Component: ui
           Product: spreadsheet

Created attachment 78757
  --> https://issues.apache.org/ooo/attachment.cgi?id=78757&action=edit
Calc spreadsheet showing affected dates

Ok, this is definitely obscure, but for the record ...

The MONTH function in Calc returns incorrect results for many dates prior to
Oct 1582.

For example,

Enter this date:
A1: 1582-01-22

Check the month for the date:
B1: =MONTH(A1)

Result: 2 (should be 1)

Change A1 to 1582-01-21

Now MONTH in B1 returns the correct result, 1

The same function, in the number formatting code, gives the correct result (for
all dates that I've checked):
C1: =A1
Format > Cells > Numbers > Format code: M (month number)

Result: 1 (correct)

This provides a simple workaround for finding the correct month:
=VALUE(TEXT(date;"M"))

The attached sheet shows which dates are affected for any given year; only
dates prior to the calendar change (October 1582 in Calc) are affected. It
seems that perhaps the MONTH code does not account properly for the ten days
skipped in the Gregorian reform.

Forum thread where the problem was first reported:
http://user.services.openoffice.org/en/forum/viewtopic.php?f=9&t=55329

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message