title: PgSqlExcetion: date/time field value out of range: "4/20/2012 12:00:00 AM"
body: <p>I want Insert Data Table in DataBase</p>
  
  <pre><code>    public void InsertNote(DataTable dataTable)
              {
                  var query = new StringBuilder();
  
                  query.Append("INSERT INTO sde.\"Table1\" 
  (id, disciplol, date, second_id, note, key) VALUES ");
  
                  foreach (DataRow row in dataTable.Rows)
                  {
                      query.AppendFormat(" ({0}, '{1}', '{2}', {3}, '{4}', '{5}'),", 
  row["classid"], row["disciplina"], row["datelesson"], row["student_id"], "", row["key"]);
                  }
  
                  // TODO : Review
                  query.Replace(',', ';', query.Length - 2, 2);
  
                  var cmd = new PgSqlCommand(query.ToString());
  
                  var con = DB.Sqlconnection;
                  cmd.Connection = con;
                  con.Open();
                  try
                  {
                      cmd.ExecuteNonQuery();
                      // result = true;
                  }
                  catch (Exception ex)
                  {
                      //result = false;
                      log.Error("InsertInTable1", ex.ToString());
                  }
                  finally
                  {
                      con.Close();
                  }
              }
  </code></pre>
  
  <p>In generated CMD I have this query:</p>
  
  <pre><code>INSERT INTO sde."RegistruNote" (first_id, discipline, date, second_id, note, key) VALUES  
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432431, 'asd', 'aWbhxZn3X'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432432, 'fas', '3Dl8YCSgX'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432433, 'asd', '8RiBgcjuL'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432434, 'fds', '8rAW1VfC7'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432435, 'gfd', 'LhRP2y5Ji'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432436, 'wer', 'lGVa5boYs'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432437, 'wer', 'hbFfo2zNg'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432438, 'we', 'xEq7iAhMi'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432439, 'rew', 'drFNV9sCm'), 
  (131415, 'Painting', '4/20/2012 12:00:00 AM', 432410, 'tw', 'dJ5XwJLQy');
  </code></pre>
  
  <p>In catch I have this exception:
  PgSqlExcetion
  date/time field value out of range: "4/20/2012 12:00:00 AM"</p>
  
  <p>Where do I have to convert the date to dd.mm.yyyy format ?</p>