My problem is that I need to cut off some of the text from a text file. Example: 01/30/2014 10:32:44 36324 36324 36324 36324 2

need to leave only the date with time tried

DateTime.Parse(line.); 

but after the line I don’t know what to write in order to cut off 19 characters and output to the console. Tried to insert Replace, but it is looking for what needs to be replaced.

    1 answer 1

    If the date is guaranteed to occupy 19 characters at the beginning of the string, you can use the Substring method:

     DateTime.Parse(line.Substring(0, 19)); 
    • Thank you very much - Ilya Vityuk