I have a date “Now.Tostring(“0101yyyy”)” and I want to subtract an Age variable from it.
Age=“20” (it’s a string)
and I want that the date after the subtract will be like this
You can try something like Now.addYears(cInt("-"+age)).toString(“0101yyyy”)
You can use: datetime.now.AddYears(-cint(Age)).ToString
Thank u guys they both work!!!
For the rest of the people that will see this correspondence
In that one it gives also the time stamp so u need to add at the end - “tostring(“ddMMyyyy”)”, so the time stamp won’t show
I have another Question
If I have the same Issue but now it’s with the months, I want to add two month (instead of May -> July)
But I want to check each time before this change if the day is over 16
if it does - do the change
if Not - don’t do that change but add only one month ahead (May -> June)
How can I do that?
Never mind I figured it out
- U need to get the current day (only day , like that: "DateTime.Now.Tostring(“dd”))
- than add an “If” activity
- The condition will be: “CInt(CurrentDate.ToString(“dd”))<16” (U need to convert the variable to Integer so u could check if it’s bigger or lower than the dayDate that u want in that case it’s “16”).