I have a date stamp (020920111422) and I want to split it to
day = 02, month = 09, year = 2011, hour = 14, and minute = 22
Is there a "split string at position" method in C#?
You want:
string x = s.Substring(0, i), y = s.Substring(i);
(or maybe i-1/i+1 depending on your exact requirements).
However, you could also use DateTime.ParseExact
to load it into a DateTime
by telling it the explicit format:
var when = DateTime.ParseExact("020920111422", "ddMMyyyyHHmm",
CultureInfo.InvariantCulture);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With