judgedk Posted March 6, 2009 Share Posted March 6, 2009 I tried severel things but cant get it to work. $d1 = _NowCalcDate() $M1 = _DateAdd("y" & "d", -1, $d1) I know this dosent work, but i guess it says what i want to do. Thanks Link to comment Share on other sites More sharing options...
Andreik Posted March 6, 2009 Share Posted March 6, 2009 I tried severel things but cant get it to work. $d1 = _NowCalcDate() $M1 = _DateAdd("y" & "d", -1, $d1) I know this dosent work, but i guess it says what i want to do. Thanks#include <Date.au3> $now = _NowCalcDate() $add = _DateAdd("Y",-1,$now) MsgBox(0,"DATE",$add) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
judgedk Posted March 6, 2009 Author Share Posted March 6, 2009 #include <Date.au3> $now = _NowCalcDate() $add = _DateAdd("Y",-1,$now) MsgBox(0,"DATE",$add) Thanks for the reply. But your examble gives today's date -1 on the year. I need to -1 on the date and -1 on the year. Thanks. Link to comment Share on other sites More sharing options...
martin Posted March 6, 2009 Share Posted March 6, 2009 Thanks for the reply.But your examble gives today's date -1 on the year.I need to -1 on the date and -1 on the year.Thanks.I think you have enough information now to work out what to do! Your example didn't work, Adreik's example did what you describe, the help tells you to use one letter and you used 2. So just do it in 2 steps. Reduce by one year then by one day. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 6, 2009 Share Posted March 6, 2009 I think you have enough information now to work out what to do! Your example didn't work, Adreik's example did what you describe, the help tells you to use one letter and you used 2. So just do it in 2 steps. Reduce by one year then by one day. As martin told you, you'll have to use two steps. Since AutoIt accepts nested function calls you could do: $YearAndDayAgo = _DateAdd("D", -1, _DateAdd("Y", -1, _NowCalcDate())) You might expect to be able to just do -366 days, but that will come out wrong for leap years. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
judgedk Posted March 6, 2009 Author Share Posted March 6, 2009 As martin told you, you'll have to use two steps. Since AutoIt accepts nested function calls you could do: $YearAndDayAgo = _DateAdd("D", -1, _DateAdd("Y", -1, _NowCalcDate())) You might expect to be able to just do -366 days, but that will come out wrong for leap years. Thank you very much, been trying a lot of different things to get this working.. but not this 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