Hola rufo.
Cita:
|
es decir yo almaceno en un campo la fecha escogida del objeto Datetimepicker
|
De este texto yo había interpretado que lo tomabas de un
TDateTimePicker de allí mi pregunta, por que si es de tipo entero:
Código Delphi
[-]
ParamByName('mes').AsInteger := MonthOf(DateTimePicker1.Date);
Si es string sin formato :
Código Delphi
[-]
ParamByName('mes').AsString := IntToStr(MonthOf(DateTimePicker1.Date));
Si es string con formato a dos caracteres:
Código Delphi
[-]
ParamByName('mes').AsString := StringOfChar('0', 2-Length(IntToStr(MonthOf(DateTimePicker1.Date)))) +
IntToStr(MonthOf(DateTimePicker1.Date));
En los tres ejemplos anteriores debe estar incluida la unidad
DateUtils.
Ahora si la fecha es tomada de un ComboBox y los items (meses) están en órden cronológico, para string formato a dos caracteres:
Código Delphi
[-]
with ComboBox1 do
if ItemIndex <> -1 then
ParamByName('mes').AsString := StringOfChar('0',2-Length(IntToStr(ItemIndex+1))) + IntToStr(ItemIndex+1);
Sin formato:
Código Delphi
[-]
with ComboBox1 do
if ItemIndex <> -1 then
ParamByName('mes').AsString := IntToStr(ItemIndex+1);
Saludos.