I get a string
value from a device like "1140421164500
". I have to convert it to DateTime
type. I want to use DateTime.ParseExact
function. I know that I can convert it by omitting the first char manually like the following:
DateTime.ParseExact("140421164500", "yyMMddHHmmss", CultureInfo.InvariantCulture);
But I want to avoid omitting the first char manually. I want to ignore it with a wildcard
char in ParseExact
function like:
DateTime.ParseExact("1140421164500", "*yyMMddHHmmss", CultureInfo.InvariantCulture);
Let me note that the first char can be 1 for daylight saving time is active, or 0 for passive. The device can send me also like "0140101000000
".
Is there anything like that for this function?