کد:
Function MiladiToShamsi(var Year, Month, Day: Word): String;
const
*count_days : array[1..12] of Byte = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var
*i: Byte;
*st: String;
*day_year: Integer;
begin
*day_year:= 0;
*for i:= 1 to month - 1 do
* *day_year:= day_year + count_days;
*day_year:= day_year + day;
*if IsLeapYear(Year) and (month > 2) then
* *Inc(day_year);
*if (day_year <= 79) then
*begin
* *if ((Year - 1) mod 4 = 0) then
* * *day_year:= day_year + 11
* *else
* * *day_year:= day_year + 10;
* *Year:= Year - 622;
* *if (day_year mod 30 = 0) then
* *begin
* * *Month:= (day_year div 30) + 9;
* * *Day:= 30;
* *end
* *else
* *begin
* * *Month:= (day_year div 30) + 10;
* * *Day:= day_year mod 30;
* *end;
*end
*else
*begin
* *year:= year - 621;
* *day_year:= day_year - 79;
* *if (day_year <= 186) then
* *begin
* * *if (day_year mod 31 = 0) then
* * *begin
* * * *Month:= (day_year div 31);
* * * *Day:= 31;
* * *end
* * *else
* * *begin
* * * *Month:= (day_year div 31) + 1;
* * * *Day:= day_year mod 31;
* * *end;
* *end
* *else
* *begin
* * *day_year:= day_year - 186;
* * *if (day_year mod 30 = 0) then
* * *begin
* * * *Month:= (day_year div 30) + 6;
* * * *Day:= 30;
* * *end
* * *else
* * *begin
* * * *Month:= (day_year div 30) + 7;
* * * *Day:= day_year mod 30;
* * *end;
* *end;
*end; * // else *.
*st:= IntToStr(Year) + "/";
*if (Month < 10) then
* *st:= st + "0";
*st:= st + IntToStr(Month) + "/";
*if (Day < 10) then
* *st:= st + "0";
*st:= st + IntToStr(Day);
*Result:= st;
end;
علاقه مندي ها (Bookmarks)