uses DateUtils
var
myDate : TDateTime;
begin
// Set up our TDateTime variable with a full date and time :
// 5th of June 2000 at 01:02:03.004 (.004 milli-seconds)
myDate := EncodeDateTime(2000, 6, 5, 1, 2, 3, 4);
// Date only - numeric values with no leading zeroes (except year)
ShowMessage(' d/m/y = '+
FormatDateTime('d/m/y', myDate));
// Date only - numeric values with leading zeroes
ShowMessage(' dd/mm/yy = '+
FormatDateTime('dd/mm/yy', myDate));
// Use short names for the day, month, and add freeform text ('of')
ShowMessage(' ddd d of mmm yyyy = '+
FormatDateTime('ddd d of mmm yyyy', myDate));
// Use long names for the day and month
ShowMessage('dddd d of mmmm yyyy = '+
FormatDateTime('dddd d of mmmm yyyy', myDate));
// Use the ShortDateFormat settings only
ShowMessage(' ddddd = '+
FormatDateTime('ddddd', myDate));
// Use the LongDateFormat settings only
ShowMessage(' dddddd = '+
FormatDateTime('dddddd', myDate));
// Use the ShortDateFormat + LongTimeFormat settings
ShowMessage(' c = '+
FormatDateTime('c', myDate));
end;
o por ejemplo en una QUERY
SQLQuery:='SELECT sum(CAST(metros AS UNSIGNED)) as metros FROM records ';
SQLQuery:= SQLQuery +'where ';
SQLQuery:= SQLQuery +'localizadorid="'+localizadores[i]+'" ';
SQLQuery:= SQLQuery +'and contacto="1" ';
SQLQuery:= SQLQuery +'and fecha="'+FormatDateTime('yyyy-mm-dd', now-1)+'" ';
// now-1 es el dia de ayer para anteayer seria now-2
.
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario