Page 1 of 1

Set Persian Date to TIntlDatePicker

PostPosted: April 21st, 2014, 8:40 pm
by zavf
Hi.

how to do set PersianDate to TIntlDatePicker?

I have using this code to IncDay and given Persian Date but i dont know firstly step set Persian (Jalali) Date

Code: Select all
function IncPersianDate(const PerDate: string;
  IncNumber: Word): string;
  var
   CalType: TCalendarClass;
   DateInc: TDate;
   Obji18n: TIntlDatePicker;
begin

  try
    Obji18n:= TIntlDatePicker.Create(nil);
    CalType:= CalendarTypes.ByIndex(3) {Jalali or Persian Calendar};
    Obji18n.CalendarType:= CalType;
    //Obji18n.Calendar.Format('q', DateInc);
    Obji18n.Calendar.IncDay(DateInc, IncNumber);
    Obji18n.Date:= DateInc;
    Result:= Obji18n.Calendar.Format('q', Obji18n.Date);
  finally
    FreeAndNil(Obji18n);
  end


end;


Using:

Code: Select all
Self.Caption:= IncPersianDate('1393/02/01', SpinEdit1.Value);


thanks mr kambiz