Convert DateTime Back into String in Specific Format

I have a series of actions which pulls a variable in the format yyMM (ie 2008 is August 2020).

I have successfully converted this variable to datetime format using:

Datetime.ParseExact(PRD,“yyMM”,globalization.CultureInfo.InvariantCulture)

then added a month to the date with

PRDdate.AddMonths(1)

all in assign activities, but now I need to convert that datetime with the month added to it back into the string format of yyMM to enter back into a terminal. How can I convert back to string in that very specific format?

PRDdate.ToString("yyMM")
or if the format is in a variable
PRPDdate.ToString(dateFormat)

It just requires that PRPDdate or whatever the variable is is a DateTime type variable.

Regards.

3 Likes

Worked perfectly once I changed the variable to datetime. Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.