Jump to content

Posisble date bug DateToDayOfWeekISO - can someone verify please?


Recommended Posts

Can some one verify if i am going mad...(build 3.3.6.1)

#include <Date.au3>

msgbox(1,"",_DateToDayOfWeekISO (@YEAR, @MON, @MDAY))

Run today (Tuesday) produces "2" for me - according to the documentation (and how it always worked for me in the past) it is should produce 1?

"Success: Returns Day of the Week Range is 0 to 6 where 0=Monday. "

Can someone independantly verify please?

Many thanks

Edited by the kick inside
Link to comment
Share on other sites

Sounds like documention is wrong.

; #FUNCTION# ====================================================================================================================
; Name...........: _DateToDayOfWeekISO
; Description ...: Returns the ISO weekdaynumber for a given date.
; Syntax.........: _DateToDayOfWeekISO($iYear, $iMonth, $iDay)
; Parameters ....: $iYear  - A valid year in format YYYY
;                  $iMonth - A valid month in format MM
;                  $iDay   - A valid day in format DD
; Return values .: Success - Returns Day of the Week Range is 1 to 7 where 1=Monday.
;                  Failure - 0 and Set @ERROR to:
;                  |0 - No error.
;                  |1 - Invalid Input Date
; Author ........: Jos van der Zande <jdeb at autoitscript dot com>
; Modified.......:
; Remarks .......:
; Related .......: _DateToDayOfWeek, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Link to comment
Share on other sites

Tuesday results in 1 as documented, from what i can tell.

#include <Date.au3>

if @WDAY = 1 Then
$day = "sun"
Elseif @WDAY = 2 Then
$day = "mon"
Elseif @WDAY = 3 Then
$day = "tue"
Elseif @WDAY = 4 Then
$day = "wed"
Elseif @WDAY = 5 Then
$day = "thur"
Elseif @WDAY = 6 Then
$day = "fri"
Elseif @WDAY = 7 Then
$day = "sat"
EndIf

msgbox (0, '' , $day)

msgbox(1,"",_DateToDayOfWeekISO (@YEAR, @MON, @MDAY))

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Hi,

The doc that I have reads as follows:

Return Value

Success: Returns Day of the Week Range is 1 to 7 where 1=Sunday.

Failure: 0 and Set @error

@error: 0 - No error.

1 - Invalid Input Date

Therefore Tuesday = 3

IT DOES sound like some conflicting doc (update autoit and scite last month).

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

That would mean there are 3 different sets of verbiage, Unless ZacUSNYR's was not an exact copy, because my date.au3 reflects the same 0 to 6 return values.

Success: Returns Day of the Week Range is 0 to 6 where 0=Monday.

Failure: 0 and Set @error

@error: 0 - No error.

1 - Invalid Input Date

v 3.3.4.0

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • Moderators

Hi all,

If you look inside Date.au3 in v3.3.6.1, you find 2 functions:

_DateToDayOfWeek where 1 = Sunday to 7 = Saturday - the Help file agrees. :P

_DateToDayOfWeekISO where 1 = Monday to 7 = Sunday - the Help file states 0 to 6, but the function is correct according to ISO 8601. :shifty:

So which of you is going to raise the ticket in Trac so it can be amended? :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I thought not, just didnt want to start rumors based off assumptions (when i can catch myself).

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • Developers

Was already corrected in the SVN lib a while ago so will be correct in the next version.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...