title: how to use datetimepicker on Delphi 7
body: <p>How to use <code>TDateTimePicker</code> with time format (hour:minute:second)?<br /> 
  I tried this code:</p>
  
  <pre><code>Sql.text:= ('select * from namatabel where namafield between '+quotedstr(formatdatetime('yyyy/mm/dd', datetimepicker1.date))+' and '+quotedstr(formatdatetime('yyyy/mm/dd', datetimepicker2.date))+' and field order by field ASC');
  </code></pre>
  
  <p>Also this code:</p>
  
  <pre><code>Sql.text:= ('select * from tablename where fieldname between '+quotedstr(formatdatetime('yyyy/mm/dd hh:mm:ss', datetimepicker1.date))+' and '+quotedstr(formatdatetime('yyyy/mm/dd hh:mm:ss', datetimepicker2.date))+' and fieldname order by fieldname ASC');
  </code></pre>
  
  <p>Also this code:</p>
  
  <pre><code>Sql.text:= ('select * from tablename where fieldname between '+quotedstr(formatdatetime('yyyy/mm/dd hh:mm:ss', datetimepicker1.datetime))+' and '+quotedstr(formatdatetime('yyyy/mm/dd hh:mm:ss', datetimepicker2.datetime))+' and fieldname order by fieldname ASC');
  </code></pre>
  
  <p>but those wont work, help me to correct them.<br />
  I'm using <a href="https://www.webyog.com/product/sqlyog" rel="nofollow">SQLYog</a> against a MySQL database.</p>
  
  <p>UPDATE </p>
  
  <p>@Jens Borrisholt i try this code before, but it doesnt work either</p>
  
  <pre><code>SQL.Add('SELECT meteran.kd_meter as no,kamar.nama,meteran.waktu,meteran.meter '+
          'FROM meteran,kamar WHERE kamar.idkamar = meteran.idkamar AND meteran.waktu BETWEEN :tgl1 and :tgl2 and waktu group by waktu asc');
  ParamByName('tgl1').AsString:=FormatDateTime('yyyy-mm-dd',DateTimePicker1.DateTime);
  ParamByName('tgl2').AsString:=FormatDateTime('yyyy-mm-dd',DateTimePicker2.DateTime); end;
  DBGrid2.DataSource.DataSet:=MyQuery2;
  </code></pre>