Sign in to follow this  
Followers 0
covaks

Adding/subtracting to @MDAY

5 posts in this topic

So, today is the 8th, and @MDAY = "08". Shouldn't @MDAY -1 = "07"?

Instead,

msgbox(1,"",@MDAY -1)

returns "7".. Similarly, adding to @MDAY also removes the leading 0 for dates between 01-09.

Is this a bug? Or am I not adding/subtracting from @MDAY properly? Or is it just not meant for that kind of thing?

Share this post


Link to post
Share on other sites



So, today is the 8th, and @MDAY = "08". Shouldn't @MDAY -1 = "07"?

Instead,

msgbox(1,"",@MDAY -1)

returns "7".. Similarly, adding to @MDAY also removes the leading 0 for dates between 01-09.

Is this a bug? Or am I not adding/subtracting from @MDAY properly? Or is it just not meant for that kind of thing?

Do this action in calculator. 08 - 1 = 7, 0 is omitted.

Share this post


Link to post
Share on other sites

Most macro's are strings. In order to perform any calculation on them, they will

automatically be converted to the appropiate variable type by AutoIt.

At least, that's my understanding of & experience with them

Share this post


Link to post
Share on other sites

Yeah, I guess that makes sense. There's no "Date" type, so it doesn't make sense for me to expect a 07.. I'm just tired, not thinking straight.. heh.

I fixed my problem by adding a check for days between 01-09 and just adding the "0" manually.

Thanks.

Share this post


Link to post
Share on other sites

MsgBox(0,"",StringFormat("%02d", @MDAY-1))

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0