var dateAndTime = DateTime.Now;
string lastTwoDigitsOfYear = DateTime.Now.ToString("yy");
int digitPlaceHolder;
digitPlaceHolder = int.Parse(lastTwoDigitsOfYear);
int stringLength = int.Parse(lastTwoDigitsOfYear);
stringLength = int.Parse(lastTwoDigitsOfYear).ToString("D4") + request.RequestId;
What I'm trying to accomplish is the following:
- Parsing DateTime to get the last two numbers of the year [15]
- Adding and concatenating the [15] with an Id as well as 4 zeroes padding it.
So in the end it would be: [15][0001][id]
This combined will result in a new variable which can be used. I'm just having trouble converting then concatenating
Cannot implicitly convert int to string
Is the error I'm receiving (obviously), but is there an elegant way of solving this error?
This may helps: