Are you saying that your input is a string, not a utcDateTime value? If so, you need two steps: first parse the string to datatime and only then create a formatted string from it.
Regarding the conversion to string, there are several options. As I mentioned in your previous thread, I like using System.String::Format() - it’s simple and easy to read:
utcDateTime value = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(), DateTimeUtil::getUserPreferredTimeZone());
str s = System.String::Format('{0:yyyy-MM-dd HH:mm:ss}', value);