stiv 0 Posted April 18 Share Posted April 18 Hello fellow autoit. I have two questions, the first is, it is possible to put the date in a variable. using <Date.au3>. the second is, it is possible to add two days to the date in a variable. using <Date.au3>. for example today is 2022/04/18. and what I want to put is 2022/04/20. Please could you give me examples. Thank you very much Link to post Share on other sites
water 2,642 Posted April 18 Share Posted April 18 1) Which date do you want to store in a variable? The current date? Including Time? 2) How would you name a function that adds dates? Did you hava a look at the list of functions the Date UDF provides? As always: the help file is your friend 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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to post Share on other sites
stiv 0 Posted April 18 Author Share Posted April 18 yes, The current date Link to post Share on other sites
water 2,642 Posted April 18 Share Posted April 18 Again have a look at the list of functions the Date UDF provides. There is a function that provides the current date/time. Assign the result of this function to a variable. Done 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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to post Share on other sites
Solution Musashi 626 Posted April 18 Solution Share Posted April 18 2 hours ago, stiv said: 1. is it possible to put the (current) date in a variable using <Date.au3> 2. is it possible to add two days to the (current) date in a variable using <Date.au3> for example 2022/04/18 -> 2022/04/20. #include <Date.au3> Local $sCurrentDate, $sNewDate $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $sNewDate = _DateAdd('d', 2, $sCurrentDate) ; current date + 2 days MsgBox(4096, "Show Dates : ", "Current "& @TAB & "= " & $sCurrentDate & @CRLF & _ "NewDate "& @TAB & "= " & $sNewDate & @CRLF) stiv 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to post Share on other sites
water 2,642 Posted April 19 Share Posted April 19 You are lucky that Musashi provided code for all of your questions 🙂Usually we do not spoon feed users with solutions. We help users to find solutions themselfes. junkew 1 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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to post Share on other sites
stiv 0 Posted April 19 Author Share Posted April 19 Thank you very much, Of course, Link to post Share on other sites
lIlIIlIllIIIIlI 2 Posted April 19 Share Posted April 19 (edited) 23 hours ago, stiv said: is it possible to put the date in a variable. #include <Date.au3> $date = _NowCalcDate() is it possible to add two days to the date in a variable, for example today is 2022/04/18. and what I want to put is 2022/04/20. #include <Date.au3> $date = _DateAdd('d', 2, _NowCalcDate()) these are basically straight from the documentationhttps://www.autoitscript.com/autoit3/docs/libfunctions/_DateAdd.htmhttps://www.autoitscript.com/autoit3/docs/libfunctions/_NowCalcDate.htm Edited April 19 by lIlIIlIllIIIIlI stiv 1 Link to post Share on other sites
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