stiv Posted April 18, 2022 Posted April 18, 2022 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
water Posted April 18, 2022 Posted April 18, 2022 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted April 18, 2022 Posted April 18, 2022 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Solution Musashi Posted April 18, 2022 Solution Posted April 18, 2022 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."
water Posted April 19, 2022 Posted April 19, 2022 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
lIlIIlIllIIIIlI Posted April 19, 2022 Posted April 19, 2022 (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, 2022 by lIlIIlIllIIIIlI stiv 1
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