yucatan Posted November 17, 2010 Share Posted November 17, 2010 Hello guys today it wensday 17 november. i wanne write a script. that i get all date's of the week. monday 15 november truesday 16 november wensday 17 november etc all days of this week with the date so 17 november . is this possible. how should i do this? Link to comment Share on other sites More sharing options...
kaotkbliss Posted November 17, 2010 Share Posted November 17, 2010 Check out the date management in the help file. it has everything you need for dates/times 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 Check out the date management in the help file. it has everything you need for dates/timesyeah i know that..i already tryed that.. Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 This gives all the days of the current week starting with monday: For $iIndex = 1 To 7 $sdate = _DateAdd("d", (@WDAY*-1) + $iIndex + 1, @YEAR & "/" & @MON & "/" & @MDAY) ConsoleWrite($sdate & @CRLF) Next My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kaotkbliss Posted November 17, 2010 Share Posted November 17, 2010 _DateDayOfWeek(@WDAY) will write out the current day of the week @WDAY will give you a number 1-7, 1=Sunday, 2=Monday etc. _DateAdd _DateDiff _NowCalcDate Will return the date in format YYYY/MM/DD _DateToMonth Writes out name of the month 1-12, 1=January That should be more than enough to get you going 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 This gives all the days of the current week starting with monday: For $iIndex = 1 To 7 $sdate = _DateAdd("d", (@WDAY*-1) + $iIndex + 1, @YEAR & "/" & @MON & "/" & @MDAY) ConsoleWrite($sdate & @CRLF) Next Nice great men, one more question. is it possible to hang this on _WeekNumberISO because what if i wanne do this but then i wanne use week 50 as info. i wanne request all dates of week 50? Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 _WeekNumberISO returns the week number. I would start with the 1st of January, check for the target weeknumber and increment if necessary using _DateAdd. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 _WeekNumberISO returns the week number.I would start with the 1st of January, check for the target weeknumber and increment if necessary using _DateAdd.i'm sorry i dont fully understand ur post. Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 i'm sorry i dont fully understand ur post.To my knowledge there is no function available that returns the start date (monday) of a given week number.So I suggest to start with 2010/01/01. Use _WeekNumberISO to get the week number for this date and compare it to the desired week number (50 in your case).If the week number has not reached the target week increment the date using _DateAdd.Run this in a loop. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 (edited) To my knowledge there is no function available that returns the start date (monday) of a given week number. So I suggest to start with 2010/01/01. Use _WeekNumberISO to get the week number for this date and compare it to the desired week number (50 in your case). If the week number has not reached the target week increment the date using _DateAdd. Run this in a loop. do u have a sample code maby? i know i can #include <Date.au3> $data = _WeekNumberISO("2011","6","14") ConsoleWrite($data) i know that i can calc the weeknumber when i have the date. i should create a loop that i runs it with all dates. put it in a array. i only dont know what is the best way to do this in a loop. Edited November 17, 2010 by yucatan Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 do u have a sample code maby?Unfortunately not.But given the needed functions in my last post it shouldn't be too hard. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 i know i'm trying. just cant figure it out. Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 Quick & Dirty: Global $sStartdate = "2010/01/01" Global $iTargetWeek = 50 While 1 $aDate = StringSplit($sStartdate, "/") $iWeek = _WeekNumberISO($aDate[1], $aDate[2], $aDate[3]) If $iWeek <> $iTargetWeek Then $sStartDate = _DateAdd("d", 1, $sStartDate) Else ExitLoop EndIf WEnd ConsoleWrite("Week " & $iTargetWeek & " starts on " & $sStartDate & @CRLF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kaotkbliss Posted November 17, 2010 Share Posted November 17, 2010 (edited) I was attempting to do something like: #include <Date.au3> $i=1 $data = _WeekNumberISO("2010",String($i),"1") ConsoleWrite("WeekISO="&$data&@CRLF) Do $i+=1 $data = _WeekNumberISO("2011",String($i),"1") ConsoleWrite("WeekISO="&$data&@CRLF) Until $data>=50 However, something with that function is not right because this is the result I got: WeekISO=52 WeekISO=5 WeekISO=9 WeekISO=13 WeekISO=17 WeekISO=22 WeekISO=26 WeekISO=31 WeekISO=35 WeekISO=39 WeekISO=44 WeekISO=48 WeekISO=-1 WeekISO=-1 WeekISO=-1...........etc. etc. etc. *edit* I know I should have set it up as #include <Date.au3> $i=0 Do $i+=1 $data = _WeekNumberISO("2011",String($i),"1") ConsoleWrite("WeekISO="&$data&@CRLF) Until $data>=50 but then it stops at month 1 day 1 with a value of 52... Edited November 17, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 (edited) However, something with that function is not right because this is the result I got:It depends on how you define "week number". Please check this.Or - even better - this. Edited November 17, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 It depends on how you define "week number". Please check this.Or - even better - this.at this point i'm stuck at the point as kaotkbliss.we still searching for a good way.the sample u gived me works good.but how can i discover the end date?how can i let this loop for for more then one week number? Link to comment Share on other sites More sharing options...
kaotkbliss Posted November 17, 2010 Share Posted November 17, 2010 That's confusing... However, this will get the variable $data close to a desired week number #include <Date.au3> $input=InputBox("enter week number","") $i=0 Do $i+=1 $data = _WeekNumberISO("2011",String($i),"7") ConsoleWrite("WeekISO="&$data&@CRLF) Until $data>=Int($input)-7 And $data<=Int($input)+7 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 (edited) at this point i'm stuck at the point as kaotkbliss.we still searching for a good way.the sample u gived me works good.but how can i discover the end date?how can i let this loop for for more then one week number?Come on - given the code in my last post this is quite easy.My code returns the first day in the week you specify.Increment the date 6 times and you have all dates of the required week! Edited November 17, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
yucatan Posted November 17, 2010 Author Share Posted November 17, 2010 Come on - given the code in my last post this is quite easy.My code returns the first day in the week you specify.Increment the date 6 times and you have all dates of the required week!yeah that i understand.but i need the start and end date of all weeks.1 until 52.if possible of different years. Link to comment Share on other sites More sharing options...
water Posted November 17, 2010 Share Posted November 17, 2010 (edited) Something to think about: 2010/01/01 is in week 52 of 2009. What do you want to get as a start of this week? If you have Outlook, check the calender to see when a week starts and ends. Edited November 17, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now