Getting error: String reference not set to an instance of a String. Parameter name: s (asp.net c#)
<p>I am using this code to truncate datetime from my database into its year and time components. The variables YearOfRelease and Runtime contain datetime of the format       "dd/MM/yyyy hh:mm:ss" It was working fine previously but its now giving the error: </p>

<p><strong>String reference not set to an instance of a String.
Parameter name: s</strong></p>

<p>It could only be something wrong in the DateTime.ParseExact function, could anyone please let me know why 'null' is suddenly causing this problem when previously it was working perfectly?</p>

<pre><code>    DateTime dt2 = new DateTime();


    dt = DateTime.ParseExact(YearOfRelease, "dd/MM/yyyy hh:mm:ss", null);

    Year = dt.Year.ToString();


    dt2 = DateTime.ParseExact(RunTime, "dd/MM/yyyy hh:mm:ss", null);
    string hour = dt2.Hour.ToString();
    string min = dt2.Minute.ToString();

    Time = hour + ":" + min;
</code></pre>
