title: VB.net checking date (year) to see if its an weird year
body: <p>I'm looping through LDAP data placing some data from that into an MS SQL database. Out of the 7k+ LDAP records, a few have been causing an issue when trying to place the <strong>lastlogin</strong> into the database that has a DateTime format.</p>
  
  <p>The problem is the date it has, <strong>12/31/1600 7:00:00 PM</strong>, is not correct and causes an error of </p>
  
  <p><strong>The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
  The statement has been terminated.</strong></p>
  
  <p>I've been checking the date format before it inserts it into the database.</p>
  
  <pre><code> If Not IsDate(empInfo.lastLogon) Then
      empInfo.lastLogon = Format(Now.AddYears(-1), "MM/dd/yyyy HH:MM:ss")
   End If
  </code></pre>
  
  <p>But doesn't seem to catch the year of <strong>1600</strong> which seems to be causing that error above.</p>
  
  <p>Is there any code I can use to detect those weird years and replace it with a random, legit date so it will place it into the database?</p>