Ver Mensaje Individual
  #4  
Antiguo 18-11-2016
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Una forma de hacerlo es usando las propiedades MinDate y MaxDate del DateTimePicker. Por ejemplo:

Código Delphi [-]
var
  Date: TDate;
  Y, M: Integer;

begin
  Date := DateTimePicker1.Date; // Tomas la fecha del primer control
  Y := DateUtils.YearOf(Date); // Tomas el año
  M := DateUtils.MonthOf(Date); // Tomas el mes

  DateTimePicker2.MinDate := EncodeDate(Y, M, 1); // Restringes el segundo control al inicio del mes
  DateTimePicker2.MaxDate := EncodeDate(Y, M, DateUtils.DaysInMonth(Date)); // Ya al final del mes
end;

LineComment Saludos
Responder Con Cita