Enter next day date

I am looking to enter a date into a system for the next day and also for the previous day.
that in the field that i need to enter the date, i need the format to be in mm/dd/yyyy format.

please can anyone help me here, i am really stuck

Suppose CurDate is a String variable set to “03/19/2020”, and you need the previous and next day. In the next few steps, we’ll create string variables PrevDate and NextDate, which you can send to your system.

1.) Assign PrevDate = Date.ParseExact(CurDate, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToString("MM/dd/yyyy")
2.) Assign NextDate = Date.ParseExact(CurDate, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(1).ToString("MM/dd/yyyy")


the date will change on the system each time the user logs in, and on working day therefore the option to create a variable with today’s date wont work if i was to log in tomorrow.

In that case, create a datetime variable set as follows:

CurDatetime = Now

That sets CurDatetime to a datetime type set to the current date and time. The time doesn’t matter, as when you add days and convert the data to a string, the time will be ignored anyway.

1 Like

like this

curdatetime = Now.AddDays(1)

curdatetime is set as a variable

Yes, that will get you tomorrow’s date. Then, you’ll need to convert it to a string so you can send it to the system you’re working with. So you’ll need to add an Assign to do the next step below.

curdatetime = Now.AddDays(1)
NextDateStr = curdatetime.ToString("MM/dd/yyyy")

Keep in mind, though, that if you need to get the previous date at this point, you would need to add -2 days, since curdatetime is now set to tomorrow’s date.

i have followed you steps however i am getting this error

@Anthony_Humphries should the curdatetime be an int variable?

Move the Assign above the Type Into. Then above that Assign, create another Assign that sets curdatetime to Now.AddDays(1). After that, pass NextDateStr to the Type Into argument.

i am still getting these errors


Can you share what the message from the ! indicators is giving? Also, what are the datatypes of curdatetime and NextDateStr?

the data time for curdatetime and nextdatestr are both set to string

curdatetime must be set to a Datetime datatype.

cool ive done that bot now types todays date @Anthony_Humphries

it should be displaying tomorrows day annoyingly

Set a breakpoint at your Type Into activity and run the process in Debug mode. When the process stops at the Type Into activity, take a screenshot of the variables under the Locals tab. Trying to figure out why it’s using today’s date rather than tomorrow’s.

this is the screenshot of the variables @Anthony_Humphries

I need a screenshot like the one below. I’m trying to evaluate what’s in curdatetime and NextDateStr.