Jump to content

Recommended Posts

Posted (edited)

GetWeekday

Get the weekday on any given date

e.g. 01.01.1990 ==> Monday

Func GetWeekday($M, $D, $Y)
    Static $WeekDay[7] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
    If ($M < 3) Then
        $M += 12
        $Y -= 1
    EndIf
    $wd = Mod($D + (2 * $M) + Floor(6 * ($M + 1) / 10) + $Y + Floor($Y / 4) - Floor($Y / 100) + Floor($Y / 400) + 1, 7)
    Return $WeekDay[$wd]
EndFunc    ;==> GetWeekday() AutoIt v3.3.12.0


; GetWeekday(Month, Day, Year)
MsgBox(0, "Get Weekday", GetWeekday(1, 1, 1990))     ; 1990-01-01 --> Monday
MsgBox(0, "Get Weekday", GetWeekday(4, 15, 2014))    ; 2014-04-15 --> Tuesday
MsgBox(0, "Get Weekday", GetWeekday(9, 9, 1999))     ; 1999-09-09 --> Thursday

Build-In

#include <Date.au3>

MsgBox(0, "", _DateDayOfWeek(_DateToDayOfWeek(@YEAR, @MON, @MDAY)))
Edited by kaesereibe
Posted

Great job! :)

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Your function is faster since

1.  it has no error checking.  try 1,0,1990

2.  it has no support for locale languages    German, French, ...

App: Au3toCmd              UDF: _SingleScript()                             

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
  • Recently Browsing   0 members

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