kaotkbliss Posted September 4, 2009 Share Posted September 4, 2009 I display the date (@YEAR&@MON&@MDAY) to get something like 20090904 (exactly as I want the format) yet, if I do any adding or subtracting days it drops leading zeros such as @YEAR&@MON&@MDAY-1 would yield 2009093 @YEAR&@MON-1&@MDAY would end up 2009903 how can I keep this from happening? I looked through the _date functions but all had different date formats and I could not seem to get them into the YYYYMMDD format I need. 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...
GEOSoft Posted September 4, 2009 Share Posted September 4, 2009 $sDate = Number(@Year & @Mon & @MDay) $sNew = Number(@Year & StringFormat("%02d", @Mon-1) & StringFormat("%02d",@MDay)) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
weaponx Posted September 5, 2009 Share Posted September 5, 2009 You can't directly perform math on dates. What do you get when you subtract from the first day of a month? Zero. What do you get when you add a day to the end of a month? 32. Use _DateAdd Link to comment Share on other sites More sharing options...
kaotkbliss Posted September 5, 2009 Author Share Posted September 5, 2009 You can't directly perform math on dates. What do you get when you subtract from the first day of a month? Zero. What do you get when you add a day to the end of a month? 32.Use _DateAddI thought that might happen, but I read in another post where someone was doing something similar so I was hoping.So it would be something like _DateAdd('d',1,YYYYMMDD)? 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...
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