mattschinkel 0 Posted January 21, 2011 How can I get the dates of all days this week into an array? sunday to saturday, in format YYY/MM/DD I searched the forums and only found week number and day of week by date. Thanks, Matt. Share this post Link to post Share on other sites
whim 1 Posted January 21, 2011 (edited) Hi, try this: #include <Date.au3> #include <Array.au3> Global $this_week[7] For $i = 0 To 6 $this_week[$i] = _DateAdd("D", $i + 1 - @WDAY, _NowCalcDate()) Next ; option: add " <--" to indicate today $this_week[@WDAY-1] &= " <--" _ArrayDisplay($this_week) edit: or this, if you want the weekdays shown as well #include <Date.au3> #include <Array.au3> Global $this_week[7][2] = [ ["", "Sun"], ["", "Mon"], ["", "Tue"], ["", "Wed"], ["", "Thu"], ["", "Fri"], ["", "Sat"] ] For $i = 0 To 6 $this_week[$i][0] = _DateAdd("D", $i + 1 - @WDAY, _NowCalcDate()) Next $this_week[@WDAY-1][1] &= " <--" ; optionally add " <--" to indicate today _ArrayDisplay($this_week) (tested on 3.3.6.1 / Win 7) Edited January 21, 2011 by whim Share this post Link to post Share on other sites
mattschinkel 0 Posted January 21, 2011 Hi, try this: #include <Date.au3> #include <Array.au3> Global $this_week[7] For $i = 0 To 6 $this_week[$i] = _DateAdd("D", $i + 1 - @WDAY, _NowCalcDate()) Next ; option: add " <--" to indicate today $this_week[@WDAY-1] &= " <--" _ArrayDisplay($this_week) (tested on 3.3.6.1 / Win 7) Your awesome, thanks! Share this post Link to post Share on other sites