possy_99 Posted May 31, 2006 Share Posted May 31, 2006 I've been tring to make a script which runs some commands then sets the system date forward three days. the problem being obviously month changes, as not all months have the same number of days, and even leap years could be a problem. Can I somehow use YDATE macro to make this any easier? something like $newdate = @YDATE + 3, but then because I'm setting the data via comspec which is expecting DD-MM-YY format, I get stuck, lol. is there any simple way of doing this? thanks for any help. Link to comment Share on other sites More sharing options...
odklizec Posted May 31, 2006 Share Posted May 31, 2006 What about _DateAdd ? Taken from Help.. #include <Date.au3> ; Add 5 days to today $sNewDate = _DateAdd( 'd',5, _NowCalcDate()) MsgBox( 4096, "", "Today + 5 days:" & $sNewDate ) Link to comment Share on other sites More sharing options...
possy_99 Posted May 31, 2006 Author Share Posted May 31, 2006 thanks for the pointer m8, I'm always in the help file too it is a great resource. Musn't have seen this one though, lol. Link to comment Share on other sites More sharing options...
possy_99 Posted May 31, 2006 Author Share Posted May 31, 2006 any pointers on how I'd get $sNewDate in to DD-MM-YY, so I can then pass on to a command prompt.. in this manner.. RunWait(@ComSpec & " /c " & 'Date ' & $newdate[DD-MM-YY], "") appreciated Link to comment Share on other sites More sharing options...
odklizec Posted May 31, 2006 Share Posted May 31, 2006 Try this.. _DateTimeSplit($sNewDate,$MyDate,$MyTime) $YY=StringTrimLeft($MyDate[1],2) $MM=StringFormat("%02i",$MyDate[2]) $DD=StringFormat("%02i",$MyDate[3]) $sDate=$YY & "-" & $MM & "-" & $DD I'm not sure StringFormat can trim the variables from left so thus StringTrimLeft is used for $YY I was only able to trim the string from right using StringFormat like that.. $YY=StringFormat("%.2s",$MyDate[1]) Link to comment Share on other sites More sharing options...
Valuater Posted May 31, 2006 Share Posted May 31, 2006 #include <Date.au3> ; Add 5 days to today $sNewDate = _DateAdd( 'd',5, _NowCalc()) $sNewDate = _DateTimeFormat($sNewDate, 2) MsgBox( 4096, "", $sNewDate) 8) Link to comment Share on other sites More sharing options...
odklizec Posted May 31, 2006 Share Posted May 31, 2006 I'm not sure this is what he wants. Using _DateTimeFormat returns year in YYYY format. And as far as I understand, he probably wants year in YY format? Link to comment Share on other sites More sharing options...
Valuater Posted May 31, 2006 Share Posted May 31, 2006 (edited) I'm not sure this is what he wants. Using _DateTimeFormat returns year in YYYY format. And as far as I understand, he probably wants year in YY format?nor I ....it is a consistant date usejust another users option8)BTW... just a tipi have NUMEROUS files with dates. Because of the many many files over years, i use yyyy/mm/dd format to help aid in my file searchesexample2004-05-212005-06-142006-03-12this is how they appear on my "sort"however, by dd/mm/yyyythe sort is not correct8) Edited May 31, 2006 by Valuater Link to comment Share on other sites More sharing options...
Emperor Posted May 31, 2006 Share Posted May 31, 2006 Here's my go at displaying the date #include <Date.au3> $Date = _DateAdd('d', 3, _NowCalcDate()) MsgBox(0, "", $Date) $Date = StringSplit($Date, "/") MsgBox(0, "", "Date: " & $Date[3] & "-" & $Date[2] & "-" & StringMid($Date[1], 3, 4)) Link to comment Share on other sites More sharing options...
Beelzel Posted June 13, 2006 Share Posted June 13, 2006 (edited) Could, I have not been too successful, this be made to display the next day in long form (Wednesady, Thursday etc). I.E. such as an information line in a messagebox "...don't forget to call <<the tomorrow display>> agent. Edited June 13, 2006 by Beelzel Link to comment Share on other sites More sharing options...
randallc Posted June 13, 2006 Share Posted June 13, 2006 (edited) Hi, #include <Date.au3> ; Add 3 days to today $sNewDate = _DateAdd( 'd',3, _NowCalc()) $sShortDate = _DateTimeFormat($sNewDate, 2) MsgBox( 4096, "", $sShortDate) $sLongDate = _DateTimeFormat($sNewDate, 1) MsgBox( 4096, "", $sLongDate) $sShortDate = StringReplace($sShortDate, "/","-") $sShortDate = StringReplace($sShortDate, "-20","-") MsgBox( 4096, "", $sShortDate)This will work for short date in local regional date format, which will be what he is requesting for DOS; though it won't appear to have worked if your local format is different [eg USA] [although yopu'll need above type formatting if this isn't accurate; DOS befor W2k, or strange DOS settings?] Best, Randall Edited June 13, 2006 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW 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