Convert Date MMDDYY to Date for database Insert
        Posted  
        
            by 
                lesponce
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by lesponce
        
        
        
        Published on 2012-09-04T03:28:34Z
        Indexed on 
            2012/09/04
            3:38 UTC
        
        
        Read the original article
        Hit count: 174
        
c#
I got an array with a date set as 071712 . no / slash characters for the date, no dash. nothing, just plain   071712 (coming from a text file).
I need to convert the date so I can include it in a SqlServer insert statement. I'm calling a stored procedure for the insert. So far I have this:
// This is not working so far.
DateTime  date = Convert.ToDateTime(fileLines[4]);
(date will be used as a parm for the stored procedure)
© Stack Overflow or respective owner