I am experimenting with C# w/ a C++ background. I have been playing with DateTime objects and find them pretty useful so far, especially the ParseExact() function!
Taking the idea of DateTime.ParseExact() one step further, I want to extract the DateTime from a string (a log entry) which will have other info in it, with variable lengths on both ends of the DateTime info.
I believe I can accomplish what I need with regular expressions, substring, and ParseExact, but I am hoping for an easier solution (just like how ParseExact turned out to be a very easy alternative to a longer, manual method). Does anyone have any suggestions?
EDIT: I don't have control over the log format, and while the format of the date and time in the log is fixed, its position is not. Thanks for the feedback! I think I will probably have to use regular expresssions!