Date Conversion
-
add 20 to the front of it ? Your question isn't making much sense, I'm afraid. Do you have this as a number, or a string ? what's the hard bit, are you assuming all dates are in the past, or not ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You can use DateTime.Parse or DateTime.ParseExact, and DateTime.ToString methods and apply a "Custom DateTime Format String" the format specifiers "y", "yy" and "yyyy" need your attention; look it up on MSDN :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
I have that same problem, a log from a third party program begins each line with YYMMDD, so my reader class has
private static readonly string Century = ( System.DateTime.Now.Year / 100 ).ToString() ;
then when I read in a line from the log, I dodate = Century + line.Substring ( 0 , 6 ) ;