Apache OpenOffice (AOO) Bugzilla – Issue 50500
WEEKDAY function (type 3) in Basic returns wrong value for mondays
Last modified: 2008-05-17 23:02:48 UTC
Using the WEEKDAY function as a formula in a spreadsheet behaves as expected with all three types: type 1: Mo = 2, type 2: Mo = 1, type 3: Mo = 0. But using WEEKDAY (type 3) in a Basic macro returns 7 instead of 0, according to the doc. See the basic code below: Public Sub TestWeekday() Dim i%, txt$ txt = "" For i = 2 To 8 ' 01.01.1900 - 07.01.1900 txt = txt & "|" & Weekday(i) Next i MsgBox "Monday-Sunday: " & txt & "|", , "Weekday Test, Type default" ' Okay txt = "" For i = 2 To 8 ' 01.01.1900 - 07.01.1900 txt = txt & "|" & Weekday(i, 1) Next i MsgBox "Monday-Sunday: " & txt & "|", , "Weekday Test, Type 1" ' Okay txt = "" For i = 2 To 8 ' 01.01.1900 - 07.01.1900 txt = txt & "|" & Weekday(i, 2) Next i MsgBox "Monday-Sunday: " & txt & "|", , "Weekday Test, Type 2" ' Okay txt = "" For i = 2 To 8 ' 01.01.1900 - 07.01.1900 txt = txt & "|" & Weekday(i, 3) Next i MsgBox "Monday-Sunday: " & txt & "|", , "Weekday Test, Type 3" ' Not okay according to doc: Monday should be '0', not '7'! End Sub
Basic isn't Calc so re-assigned to Framework
Hi Joerg, please have a look at this one. Frank
jsk->ab: I am not familiar with this function and cannot determine whether this is a documentation issue or a bug in the implementation or none of both. So i reassign it to you.
ab->jsk: You could have a look at the online help like I did... This is neither a documentation nor a implementation bug. It's no bug at all. The Weekday function in the spreadsheet has no direct connec- tion to the Weekday function in Basic. Both functions behave like spe- cified in the CORRESPONDING documentation. At least that's true for the Basic function. The sample program has exactly the same output as VB and I can see no conflict with the Basic(!) online help. -> Invalid
The Issue you raised has been marked as 'Resolved' and not updated within the last 1 year+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous posting: Verified -> Closed. A Closed Issue is a Happy Issue (TM). Regards, Andrew