Sign in to follow this  
Followers 0
kaesereibe

GetWeekday

3 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



Great job! :)


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

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, ...


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
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
Sign in to follow this  
Followers 0