Issue 50500 - WEEKDAY function (type 3) in Basic returns wrong value for mondays
Summary: WEEKDAY function (type 3) in Basic returns wrong value for mondays
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 680m104
Hardware: PC Windows 2000
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ab
QA Contact: issues@framework
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2005-06-08 16:53 UTC by fuege
Modified: 2008-05-17 23:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description fuege 2005-06-08 16:53:02 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
Comment 1 frank 2005-06-16 11:43:10 UTC
Basic isn't Calc so re-assigned to Framework
Comment 2 frank 2005-06-16 11:43:42 UTC
Hi Joerg,

please have a look at this one.

Frank
Comment 3 joerg.skottke 2005-06-24 10:14:48 UTC
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.
Comment 4 ab 2005-07-04 13:32:09 UTC
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
Comment 5 ace_dent 2008-05-17 21:00:55 UTC
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
Comment 6 ace_dent 2008-05-17 23:02:48 UTC
As per previous posting: Verified -> Closed.
A Closed Issue is a Happy Issue (TM).

Regards,
Andrew