برگزیده های پرشین تولز

فارسي كردن تاريخ وبلاگ در بلاگر

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
برای فارسی کردن تاريخ وبلاگتان از اسکريپت زير استفاده کنيد .
برای اطلاع بيشتر و انواع دستکاری های ديگر ميتونيد سورس
کشکول رو ببينيد.
اول اين اسکريپت رو درهد صفحه خود بنويسيد

[code:1]

<script>

function datetoshamsi(gtext){

mydate2 = new Date(gtext);

mydate= new Date("March 21, 2001");

//sDay=getsday(mydate.getDay());

Stime=mydate.getTime();

Stime2=mydate2.getTime();

sdays=Math.floor((Stime2-Stime)/86400000);

syears=Math.floor(sdays/365);

sdays -= (syears * 365);

syears+=1380;

if (sdays > 186) {

smonths = 6;

sdays-=186;

smonths2 = Math.floor(sdays/30);

sdays -= (smonths2 * 30);

smonths += smonths2;

}

else {

smonths= Math.floor(sdays/31);

sdays -= (smonths * 31);

}

smonths++;

sdays++;

return (syears + "/" + smonths +"/" + sdays);

}[/code:1]

بعد کد زير رو يه جايي توی بادی که دوست داريد تاريخ نوشته بشه قرار بديد
انتخاب بهترين جا يه خورده تمرين مي خواد.

[code:1]

span

class="date"<script>document.write(datetoshamsi("<$BlogDateHeaderDate$>"))[/code:1]

منبع :

<a href='http://salek.blogspot.com/2002_02_24_salek_archive.html' target='_blank'>http://salek.blogspot.com/2002_02_24_salek...ek_archive.html</a>
 

Nicnam

Registered User
تاریخ عضویت
19 دسامبر 2002
نوشته‌ها
277
لایک‌ها
2
سن
39
محل سکونت
تهران-مشهد (یکی در میون، منگولتینا)
اين جا رو هم ببينيد! اين روش كامل تريه
<a href='http://forum.persiantools.com/viewtopic.php?t=286' target='_blank'>http://forum.persiantools.com/viewtopic.php?t=286</a>
 

Nicnam

Registered User
تاریخ عضویت
19 دسامبر 2002
نوشته‌ها
277
لایک‌ها
2
سن
39
محل سکونت
تهران-مشهد (یکی در میون، منگولتینا)
اين رو در Head اضافه كنيد[code:1]var dkSolar = 0;

var dkGregorian = 1;



var DaysOfMonths = new Array&#40;&#41;;

var LeapMonth = new Array&#40;&#41;;

var DaysToMonth = new Array&#40;&#41;;



DaysOfMonths = &#91;&#91;31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29&#93;, &#91;31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31&#93;&#93;;

LeapMonth = &#91;12, 2&#93;;

DaysToMonth = &#91;&#91;0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365&#93;, &#91;0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365&#93;&#93;;



function Integer&#40;val&#41;

&#123;

this.value = val;

&#125;



function IsLeapYear&#40;DateKind, Year&#41;

&#123;

if &#40;DateKind == dkSolar&#41;

return &#40;&#40;&#40;&#40;Year + 38&#41; * 31&#41; % 128&#41; &#60;= 30&#41;;

else

return &#40;&#40;&#40;Year % 4&#41; == 0&#41; && &#40;&#40;&#40;Year % 100&#41; != 0&#41; || &#40;&#40;Year % 400&#41; == 0&#41;&#41;&#41;;

&#125;



function DaysOfMonth&#40;DateKind, Year, Month&#41;

&#123;

var Result;

if &#40;&#40;Year != 0&#41; && &#40;&#40;Month &#60;= 12&#41; && &#40;Month &#62;= 1&#41;&#41;&#41;

&#123;

Result = DaysOfMonths&#91;DateKind&#93;&#91;Month - 1&#93;;

if &#40;&#40;Month == LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function IsDateValid&#40;DateKind, Year, Month, Day&#41;

&#123;

return &#40;&#40;Year!= 0&#41; && &#40;Month &#62;= 1&#41; && &#40;Month &#60;= 12&#41; && &#40;Day &#62;= 1&#41; && Day &#60;= &#40;DaysOfMonth&#40;DateKind, Year, Month&#41;&#41;&#41;;

&#125;



function DaysToDate&#40;DateKind, Year, Month, Day&#41;

&#123;

var Result;

if &#40;IsDateValid&#40;DateKind, Year, Month, Day&#41;&#41;

&#123;

Result = DaysToMonth&#91;DateKind&#93;&#91;Month - 1&#93; + Day;

if &#40;&#40;Month &#62; LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function DateOfDay&#40;DateKind, Days, Year, Month, Day&#41;

&#123;

var LeapDay = 0;

Month.value = 0;

Day.value = 0;

for &#40;var m = 2; m &#60;= 13; m++&#41;

&#123;

if &#40;&#40;m &#62; LeapMonth&#91;DateKind&#93;&#41; && &#40;IsLeapYear&#40;DateKind, Year&#41;&#41;&#41; LeapDay = 1;

if &#40;Days &#60;= &#40;DaysToMonth&#91;DateKind&#93;&#91;m - 1&#93; + LeapDay&#41;&#41;

&#123;

Month.value = m - 1;

if &#40;Month.value &#60;= LeapMonth&#91;DateKind&#93;&#41; LeapDay = 0;

Day.value = Days - &#40;DaysToMonth&#91;DateKind&#93;&#91;Month.value - 1&#93; + LeapDay&#41;;

break;

&#125;

&#125;

return IsDateValid&#40;DateKind, Year, Month.value, Day.value&#41;;

&#125;



function GregorianToSolar&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevGregorianLeap, Result;

if &#40;IsDateValid&#40;dkGregorian, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevGregorianLeap = IsLeapYear&#40;dkGregorian, Year.value - 1&#41;;

Days = DaysToDate&#40;dkGregorian, Year.value, Month.value, Day.value&#41;;

Year.value -= 622;

if &#40;IsLeapYear&#40;dkSolar, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevGregorianLeap && &#40;LeapDay == 1&#41;&#41; Days += 287

else Days += 286;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkSolar, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



function SolarToGregorian&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevSolarLeap, Result;

if &#40;IsDateValid&#40;dkSolar, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevSolarLeap = IsLeapYear&#40;dkSolar, Year.value - 1&#41;;

Days = DaysToDate&#40;dkSolar, Year.value, Month.value, Day.value&#41;;

Year.value += 621;

if &#40;IsLeapYear&#40;dkGregorian, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevSolarLeap && &#40;LeapDay = 1&#41;&#41; Days += 80

else Days += 79;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkGregorian, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



var MonthNames = new Array&#40;&#41;;

var WeekDayNames = new Array&#40;&#41;;

var MonthDayNames = new Array&#40;&#41;;

MonthNames = &#91;&#34;&#1601;&#1585;&#1608;&#1585;&#1583;&#1740;&#1606;&#34;, &#34;&#1575;&#1585;&#1583;&#1740;&#1576;&#1607;&#1588;&#1578;&#34;, &#34;&#1582;&#1585;&#1583;&#1575;&#1583;&#34;, &#34;&#1578;&#1740;&#1585;&#34;, &#34;&#1605;&#1585;&#1583;&#1575;&#1583;&#34;, &#34;&#1588;&#1607;&#1585;&#1740;&#1608;&#1585;&#34;, &#34;&#1605;&#1607;&#1585;&#34;, &#34;&#1570;&#1576;&#1575;&#1606;&#34;, &#34;&#1570;&#1584;&#1585;&#34;, &#34;&#1583;&#1740;&#34;, &#34;&#1576;&#1607;&#1605;&#1606;&#34;, &#34;&#1575;&#1587;&#1601;&#1606;&#1583;&#34;&#93;;

WeekDayNames = &#91;&#34;&#1740;&#1705;&#1588;&#1606;&#1576;&#1607;&#34;, &#34;&#1583;&#1608;&#1588;&#1606;&#1576;&#1607;&#34;, &#34;&#1587;&#1607; &#1588;&#1606;&#1576;&#1607;&#34;, &#34;&#1670;&#1607;&#1575;&#1585; &#1588;&#1606;&#1576;&#1607;&#34;, &#34;&#1662;&#1606;&#1580; &#1588;&#1606;&#1576;&#1607;&#34;, &#34;&#1580;&#1605;&#1593;&#1607;&#34;, &#34;&#1588;&#1606;&#1576;&#1607;&#34;&#93;;

MonthDayNames = &#91;&#34;&#1575;&#1608;&#1604;&#34;, &#34;&#1583;&#1608;&#1605;&#34;, &#34;&#1587;&#1608;&#1605;&#34;, &#34;&#1670;&#1607;&#1575;&#1585;&#1605;&#34;, &#34;&#1662;&#1606;&#1580;&#1605;&#34;, &#34;&#1588;&#1588;&#1605;&#34;, &#34;&#1607;&#1601;&#1578;&#1605;&#34;, &#34;&#1607;&#1588;&#1578;&#1605;&#34;, &#34;&#1606;&#1607;&#1605;&#34;, &#34;&#1583;&#1607;&#1605;&#34;, &#34;&#1740;&#1575;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1583;&#1608;&#1575;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1587;&#1740;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1670;&#1607;&#1575;&#1585;&#1583;&#1607;&#1605;&#34;, &#34;&#1662;&#1575;&#1606;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1588;&#1575;&#1606;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1607;&#1601;&#1583;&#1607;&#1605;&#34;, &#34;&#1607;&#1580;&#1583;&#1607;&#1605;&#34;, &#34;&#1606;&#1608;&#1586;&#1583;&#1607;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1740;&#1705;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1583;&#1608;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1587;&#1608;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1670;&#1607;&#1575;&#1585;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1662;&#1606;&#1580;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1588;&#1588;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1607;&#1601;&#1578;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1607;&#1588;&#1578;&#1605;&#34;, &#34;&#1576;&#1740;&#1587;&#1578; &#1608; &#1606;&#1607;&#1605;&#34;, &#34;&#1587;&#1740; &#1575;&#1605;&#34;, &#34;&#1587;&#1740; &#1608; &#1740;&#1705;&#1605;&#34;&#93;;



function ConvertStr&#40;DateStr, Format&#41;

&#123;

var Result;

var ObjDate = new Date&#40;&#41;;

var SplDate = DateStr.split&#40;&#34;/&#34;&#41;;

var M = new Integer&#40;parseInt&#40;SplDate&#91;0&#93;&#41;&#41;;

var D = new Integer&#40;parseInt&#40;SplDate&#91;1&#93;&#41;&#41;;

var Y = new Integer&#40;parseInt&#40;SplDate&#91;2&#93;&#41;&#41;;

ObjDate.setFullYear&#40;Y.value&#41;;

ObjDate.setMonth&#40;M.value - 1&#41;;

ObjDate.setDate&#40;D.value&#41;;

var W = ObjDate.getDay&#40;&#41;;



if &#40;GregorianToSolar&#40;Y, M, D&#41;&#41;

switch &#40;Format&#41;

&#123;

case 0&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 1&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 2&#58;

Result = &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 3&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 4&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#1605;&#1575;&#1607; &#34; + Y.value&#41;;

break;

case 5&#58;

Result = WeekDayNames&#91;W&#93; + &#34;&#1548; &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 6&#58;

Result = WeekDayNames&#91;W&#93; + &#34;&#1548; &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 7&#58;

Result = WeekDayNames&#91;W&#93; + &#34;&#1548; &#34; + &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 8&#58;

Result = WeekDayNames&#91;W&#93; + &#34;&#1548; &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 9&#58;

Result = WeekDayNames&#91;W&#93; + &#34;&#1548; &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#1605;&#1575;&#1607; &#34; + Y.value&#41;;

break;

default&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

&#125;

else

Result = &#34;Error converting date.&#34;;

return Result;

&#125;



function ConvertDateTag&#40;DateStr, Format&#41;

&#123;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + ConvertStr&#40;DateStr, Format&#41; + &#34;&#60;/div&#62;&#34;;

&#125;



function ConvertArchiveTag&#40;DatesStr, Format&#41;

&#123;

var Dates = new Array&#40;&#41;;

Dates = DatesStr.split&#40;&#34;-&#34;&#41;;

var Result = ConvertStr&#40;Dates&#91;0&#93;, Format&#41; + &#34; - &#34; + ConvertStr&#40;Dates&#91;1&#93;, Format&#41;;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + Result + &#34;&#60;/div&#62;&#34;;

&#125;





&#60;Blogger&#62;

document.write&#40;&#34;&#60;a href='&#60;$BlogArchiveLink$&#62;'&#62;&#34;&#41;

document.write&#40;ConvertArchiveTag&#40;'&#60;$BlogArchiveName$&#62;'&#41;&#41;

document.write&#40;&#34;&#60;/a&#62;&#34;&#41;

&#60;/Blogger&#62;

if &#40;location.href.indexOf&#40;&#34;archive&#34;&#41; != -1&#41; &#123;

document.write&#40;&#34;&#60;a href=&#34;./&#34;&#62;current&#60;/a&#62;&#34;&#41;

&#125; [/code:1] و هر جا [code:1]&#60;BlogDateHeader&#62;[/code:1] رو ديديد، اين رو جايگزينش كنيد
[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

document.write&#40;ConvertDateTag&#40;&#34;&#60;$BlogDateHeaderDate$&#62;&#34;, 9&#41;&#41;;

// --&#62;

&#60;/script&#62;[/code:1]
اون عدد نهي هم كه تو اسكريپت مي بينيد، قابل تغييره به 0 تا 9. تست كنيد، شيوه هاي مختلف نمايش تاريخه[/code]
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
سلام :( ببين من يكسري مشكلات پيدا كردم تم بلاگر اين تاريخ فارسي رو كه مي گي من درست كردم ولي خراب كاري شدش تو مطميني كه چيزي رو جا ننداختي؟

يك سوال ديگه وقتي كه تمپليت رو عوض مي كني تو بلاگر بايد آرشيو ها رو هم پابليش كني دوباره يا نه؟

بعدش چرا انقدر دير نشون ميده نتيجه تغييرات رو
 

ehsaan

کاربر تازه وارد
تاریخ عضویت
21 دسامبر 2002
نوشته‌ها
80
لایک‌ها
11
اين راهنمايي اقاي بنايي هم چيزخوبيه:
<a href='http://www.hamedbanaei.com/services/default.aspx' target='_blank'>http://www.hamedbanaei.com/services/default.aspx</a>
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
سلام مرسي از لينك همانطور كه مي دوني مال حامد سورس رو در اختيار نمي گذاره چون با asp شده
من مي خواهم سورس قضه رو ببينم
ولي كار راه انداز هستش ممنون
سورس رو هم براي هممين مي خواهم كه بدونم جلالي نوشته شده يا نه چون يك ايرادي دارد در سالهاي كبيسه
حالا تو يك نگاهي به همون كدهاي بالا بيانداز ممنون و به من عملياتي بگو كه چي كار كنم
تا با اون كدها درست شود همه چيز
 

daryoosh4

کاربر تازه وارد
تاریخ عضویت
3 مارس 2003
نوشته‌ها
13
لایک‌ها
0
متاسفانه دوستان در ارائه ي كدهاي مربوط به قالب تاريخ شمسي اشتباهاتي كرده اند. كد دومي كه نيكنام بالاتر گفته است، اشتباه دارد. كد دوم يعني:
[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

document.write&#40;ConvertDateTag&#40;&#34;&#60;$BlogDateHeaderDate$&#62;&#34;, 0&#41;&#41;;

// --&#62;

&#60;/script&#62;[/code:1]
را بايد به جاي اين كد قرار داد:
[code:1]&#60;$BlogDateHeaderDate$&#62;[/code:1]
كه نيكنام به اشتباه نوشته است:
[code:1]&#60;BlogDateHeader&#62;[/code:1]
همچنين، به ابتداي كد اولي اين را:
[code:1]&#60;script language=&#34;JavaScript&#34;&#62;[/code:1]
و به انتهاي آن، اين كد را اضافه كنيد:
[code:1]&#60;/script&#62;[/code:1]
ضمنا اگر در ابتداي كار، در بخش Settings نحوه ي تاريخ نگاري را به صورت 2002/30/12 درنياوريد، كل اين برنامه كار نخواهد كرد.
اگر در اين مورد باز اشكالي داشتيد، بنويسيد تا جواب دهم. [/code]
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
سلام ممنونم از راهنمايي حتما در اولين فرصت امتحان مي كنم تا جواب بگيرم خيلي لطف كردي
 

daryoosh4

کاربر تازه وارد
تاریخ عضویت
3 مارس 2003
نوشته‌ها
13
لایک‌ها
0
اميدوارم كه مفيد باشد.
<a href='http://trita.blogspot.com' target='_blank'>http://trita.blogspot.com</a>
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
سلام من اين رو عينا

[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

var dkSolar = 0;

var dkGregorian = 1;



var DaysOfMonths = new Array&#40;&#41;;

var LeapMonth = new Array&#40;&#41;;

var DaysToMonth = new Array&#40;&#41;;



DaysOfMonths = &#91;&#91;31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29&#93;, &#91;31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31&#93;&#93;;

LeapMonth = &#91;12, 2&#93;;

DaysToMonth = &#91;&#91;0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365&#93;, &#91;0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365&#93;&#93;;



function Integer&#40;val&#41;

&#123;

this.value = val;

&#125;



function IsLeapYear&#40;DateKind, Year&#41;

&#123;

if &#40;DateKind == dkSolar&#41;

return &#40;&#40;&#40;&#40;Year + 38&#41; * 31&#41; % 128&#41; &#60;= 30&#41;;

else

return &#40;&#40;&#40;Year % 4&#41; == 0&#41; && &#40;&#40;&#40;Year % 100&#41; != 0&#41; || &#40;&#40;Year % 400&#41; == 0&#41;&#41;&#41;;

&#125;



function DaysOfMonth&#40;DateKind, Year, Month&#41;

&#123;

var Result;

if &#40;&#40;Year != 0&#41; && &#40;&#40;Month &#60;= 12&#41; && &#40;Month &#62;= 1&#41;&#41;&#41;

&#123;

Result = DaysOfMonths&#91;DateKind&#93;&#91;Month - 1&#93;;

if &#40;&#40;Month == LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function IsDateValid&#40;DateKind, Year, Month, Day&#41;

&#123;

return &#40;&#40;Year!= 0&#41; && &#40;Month &#62;= 1&#41; && &#40;Month &#60;= 12&#41; && &#40;Day &#62;= 1&#41; && Day &#60;= &#40;DaysOfMonth&#40;DateKind, Year, Month&#41;&#41;&#41;;

&#125;



function DaysToDate&#40;DateKind, Year, Month, Day&#41;

&#123;

var Result;

if &#40;IsDateValid&#40;DateKind, Year, Month, Day&#41;&#41;

&#123;

Result = DaysToMonth&#91;DateKind&#93;&#91;Month - 1&#93; + Day;

if &#40;&#40;Month &#62; LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function DateOfDay&#40;DateKind, Days, Year, Month, Day&#41;

&#123;

var LeapDay = 0;

Month.value = 0;

Day.value = 0;

for &#40;var m = 2; m &#60;= 13; m++&#41;

&#123;

if &#40;&#40;m &#62; LeapMonth&#91;DateKind&#93;&#41; && &#40;IsLeapYear&#40;DateKind, Year&#41;&#41;&#41; LeapDay = 1;

if &#40;Days &#60;= &#40;DaysToMonth&#91;DateKind&#93;&#91;m - 1&#93; + LeapDay&#41;&#41;

&#123;

Month.value = m - 1;

if &#40;Month.value &#60;= LeapMonth&#91;DateKind&#93;&#41; LeapDay = 0;

Day.value = Days - &#40;DaysToMonth&#91;DateKind&#93;&#91;Month.value - 1&#93; + LeapDay&#41;;

break;

&#125;

&#125;

return IsDateValid&#40;DateKind, Year, Month.value, Day.value&#41;;

&#125;



function GregorianToSolar&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevGregorianLeap, Result;

if &#40;IsDateValid&#40;dkGregorian, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevGregorianLeap = IsLeapYear&#40;dkGregorian, Year.value - 1&#41;;

Days = DaysToDate&#40;dkGregorian, Year.value, Month.value, Day.value&#41;;

Year.value -= 622;

if &#40;IsLeapYear&#40;dkSolar, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevGregorianLeap && &#40;LeapDay == 1&#41;&#41; Days += 287

else Days += 286;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkSolar, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



function SolarToGregorian&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevSolarLeap, Result;

if &#40;IsDateValid&#40;dkSolar, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevSolarLeap = IsLeapYear&#40;dkSolar, Year.value - 1&#41;;

Days = DaysToDate&#40;dkSolar, Year.value, Month.value, Day.value&#41;;

Year.value += 621;

if &#40;IsLeapYear&#40;dkGregorian, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevSolarLeap && &#40;LeapDay = 1&#41;&#41; Days += 80

else Days += 79;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkGregorian, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



var MonthNames = new Array&#40;&#41;;

var WeekDayNames = new Array&#40;&#41;;

var MonthDayNames = new Array&#40;&#41;;

MonthNames = &#91;&#34;فروردین&#34;, &#34;اردیبهشت&#34;, &#34;خرداد&#34;, &#34;تیر&#34;, &#34;مرداد&#34;, &#34;شهریور&#34;, &#34;مهر&#34;, &#34;آبان&#34;, &#34;آذر&#34;, &#34;دی&#34;, &#34;بهمن&#34;, &#34;اسفند&#34;&#93;;

WeekDayNames = &#91;&#34;یکشنبه&#34;, &#34;دوشنبه&#34;, &#34;سه شنبه&#34;, &#34;چهار شنبه&#34;, &#34;پنج شنبه&#34;, &#34;جمعه&#34;, &#34;شنبه&#34;&#93;;

MonthDayNames = &#91;&#34;اول&#34;, &#34;دوم&#34;, &#34;سوم&#34;, &#34;چهارم&#34;, &#34;پنجم&#34;, &#34;ششم&#34;, &#34;هفتم&#34;, &#34;هشتم&#34;, &#34;نهم&#34;, &#34;دهم&#34;, &#34;یازدهم&#34;, &#34;دوازدهم&#34;, &#34;سیزدهم&#34;, &#34;چهاردهم&#34;, &#34;پانزدهم&#34;, &#34;شانزدهم&#34;, &#34;هفدهم&#34;, &#34;هجدهم&#34;, &#34;نوزدهم&#34;, &#34;بیستم&#34;, &#34;بیست و یکم&#34;, &#34;بیست و دوم&#34;, &#34;بیست و سوم&#34;, &#34;بیست و چهارم&#34;, &#34;بیست و پنجم&#34;, &#34;بیست و ششم&#34;, &#34;بیست و هفتم&#34;, &#34;بیست و هشتم&#34;, &#34;بیست و نهم&#34;, &#34;سی ام&#34;, &#34;سی و یکم&#34;&#93;;



function ConvertStr&#40;DateStr, Format&#41;

&#123;

var Result;

var ObjDate = new Date&#40;&#41;;

var SplDate = DateStr.split&#40;&#34;/&#34;&#41;;

var M = new Integer&#40;parseInt&#40;SplDate&#91;0&#93;&#41;&#41;;

var D = new Integer&#40;parseInt&#40;SplDate&#91;1&#93;&#41;&#41;;

var Y = new Integer&#40;parseInt&#40;SplDate&#91;2&#93;&#41;&#41;;

ObjDate.setFullYear&#40;Y.value&#41;;

ObjDate.setMonth&#40;M.value - 1&#41;;

ObjDate.setDate&#40;D.value&#41;;

var W = ObjDate.getDay&#40;&#41;;



if &#40;GregorianToSolar&#40;Y, M, D&#41;&#41;

switch &#40;Format&#41;

&#123;

case 0&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 1&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 2&#58;

Result = &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 3&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 4&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

case 5&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 6&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 7&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 8&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 9&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

default&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

&#125;

else

Result = &#34;Error converting date.&#34;;

return Result;

&#125;



function ConvertDateTag&#40;DateStr, Format&#41;

&#123;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + ConvertStr&#40;DateStr, Format&#41; + &#34;&#60;/div&#62;&#34;;

&#125;



function ConvertArchiveTag&#40;DatesStr, Format&#41;

&#123;

var Dates = new Array&#40;&#41;;

Dates = DatesStr.split&#40;&#34;-&#34;&#41;;

var Result = ConvertStr&#40;Dates&#91;0&#93;, Format&#41; + &#34; - &#34; + ConvertStr&#40;Dates&#91;1&#93;, Format&#41;;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + Result + &#34;&#60;/div&#62;&#34;;

&#125;





&#60;Blogger&#62;

document.write&#40;&#34;&#60;a href='&#60;$BlogArchiveLink$&#62;'&#62;&#34;&#41;

document.write&#40;ConvertArchiveTag&#40;'&#60;$BlogArchiveName$&#62;'&#41;&#41;

document.write&#40;&#34;&#60;/a&#62;&#34;&#41;

&#60;/Blogger&#62;

if &#40;location.href.indexOf&#40;&#34;archive&#34;&#41; != -1&#41; &#123;

document.write&#40;&#34;&#60;a href=&#34;./&#34;&#62;current&#60;/a&#62;&#34;&#41;

&#125;

&#60;/script&#62;[/code:1]تو هد گذاشتم

و اين رو هم


[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

document.write&#40;ConvertDateTag&#40;&#34;&#60;$BlogDateHeaderDate$&#62;&#34;, 0&#41;&#41;;

// --&#62;

&#60;/script&#62;[/code:1]با اين

[code:1]&#60;$BlogDateHeaderDate$&#62;[/code:1]


جايگزين كردم ولي همه چيز ريختش به هم كجا اشتباه كردم و مشكلش چيه؟

راه‌نمايي كنيد ممنون
 

ehsan

Administrator
مدیر انجمن
Administrator
تاریخ عضویت
5 دسامبر 2002
نوشته‌ها
7,949
لایک‌ها
3,918
محل سکونت
Internet

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
كلا استايل و ريخت قيافه ي وب لاگ رو نياورد احسان اين كدها درسته يا نه؟ تو خودت امتحان كردي؟
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
فرض بر این است که شما کاربر سایت Blogger هستید و می خواهید تاریخهای وبلاگتان را فارسی کنید. گامهای زیر را یک به یک دنبال کنید:

به سایت بلاگر رفته و Login کنید و به صفحهء اصلی ویرایش وبلاگ مورد نظر بروید.
با فشردن دکمهء Settings از نوار ابزار بالای صفحه به بخش تنظیمات وبلاگ بروید.
قالب نمایش تاریخ را به m/d/yyyy تغییر دهید. در این حال تاریخ بدین صورت نمایش داده خواهد شد: 2002/30/12
تغییرات را ذخیره کرده و به صفحهء اصلی بازگردید. (این کار به طور خودکار انجام خواهد شد.)
دکمهء Template را از نوار ابزار انتخاب کنید تا به صفحهء تغییر قالب هدایت شوید.
در متن قالبی که می بینید، <head> و <head/> را بیابید. (بزرگ و کوچک بودن حروف اهمیتی ندارد.)
كل كدهاي زير رو در جايي پس از <head> و پیش از <head/> کپی کنید.

[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

&#60;!--

// --&#62;



/********************************************************************************/

/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* solar.js - Solar Date Utility Functions &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* Copyright&#40;C&#41; 2002-2003 Mahmood Shafiee Zargar, all rights reserved. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* [email protected] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* http&#58;//sobh.netfirms.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */

/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* Original Pascal Code By Kambiz R. Khojaste &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */

/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/* This file is provided &#34;AS IS&#34; without any warranty of any kind, either &nbsp; &nbsp; &nbsp; */

/* express or implied. The entire risk as to the quality and performance &nbsp; &nbsp; &nbsp; &nbsp;*/

/* of the functions provided in this unit are with you. The author is NOT &nbsp; &nbsp; &nbsp; */

/* liable for any DAMAGES resulting from the use and misuse of the unit, &nbsp; &nbsp; &nbsp; &nbsp;*/

/* especially he is NOT liable for DAMAGES that were caused BY ANY VERSION &nbsp; &nbsp; &nbsp;*/

/* WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */

/* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/

/********************************************************************************/



var dkSolar = 0;

var dkGregorian = 1;



var DaysOfMonths = new Array&#40;&#41;;

var LeapMonth = new Array&#40;&#41;;

var DaysToMonth = new Array&#40;&#41;;



DaysOfMonths = &#91;&#91;31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29&#93;, &#91;31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31&#93;&#93;;

LeapMonth = &#91;12, 2&#93;;

DaysToMonth = &#91;&#91;0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365&#93;, &#91;0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365&#93;&#93;;



function Integer&#40;val&#41;

&#123;

this.value = val;

&#125;



function IsLeapYear&#40;DateKind, Year&#41;

&#123;

if &#40;DateKind == dkSolar&#41;

return &#40;&#40;&#40;&#40;Year + 38&#41; * 31&#41; % 128&#41; &#60;= 30&#41;;

else

return &#40;&#40;&#40;Year % 4&#41; == 0&#41; && &#40;&#40;&#40;Year % 100&#41; != 0&#41; || &#40;&#40;Year % 400&#41; == 0&#41;&#41;&#41;;

&#125;



function DaysOfMonth&#40;DateKind, Year, Month&#41;

&#123;

var Result;

if &#40;&#40;Year != 0&#41; && &#40;&#40;Month &#60;= 12&#41; && &#40;Month &#62;= 1&#41;&#41;&#41;

&#123;

Result = DaysOfMonths&#91;DateKind&#93;&#91;Month - 1&#93;;

if &#40;&#40;Month == LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function IsDateValid&#40;DateKind, Year, Month, Day&#41;

&#123;

return &#40;&#40;Year!= 0&#41; && &#40;Month &#62;= 1&#41; && &#40;Month &#60;= 12&#41; && &#40;Day &#62;= 1&#41; && Day &#60;= &#40;DaysOfMonth&#40;DateKind, Year, Month&#41;&#41;&#41;;

&#125;



function DaysToDate&#40;DateKind, Year, Month, Day&#41;

&#123;

var Result;

if &#40;IsDateValid&#40;DateKind, Year, Month, Day&#41;&#41;

&#123;

Result = DaysToMonth&#91;DateKind&#93;&#91;Month - 1&#93; + Day;

if &#40;&#40;Month &#62; LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function DateOfDay&#40;DateKind, Days, Year, Month, Day&#41;

&#123;

var LeapDay = 0;

Month.value = 0;

Day.value = 0;

for &#40;var m = 2; m &#60;= 13; m++&#41;

&#123;

if &#40;&#40;m &#62; LeapMonth&#91;DateKind&#93;&#41; && &#40;IsLeapYear&#40;DateKind, Year&#41;&#41;&#41; LeapDay = 1;

if &#40;Days &#60;= &#40;DaysToMonth&#91;DateKind&#93;&#91;m - 1&#93; + LeapDay&#41;&#41;

&#123;

Month.value = m - 1;

if &#40;Month.value &#60;= LeapMonth&#91;DateKind&#93;&#41; LeapDay = 0;

Day.value = Days - &#40;DaysToMonth&#91;DateKind&#93;&#91;Month.value - 1&#93; + LeapDay&#41;;

break;

&#125;

&#125;

return IsDateValid&#40;DateKind, Year, Month.value, Day.value&#41;;

&#125;



function GregorianToSolar&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevGregorianLeap, Result;

if &#40;IsDateValid&#40;dkGregorian, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevGregorianLeap = IsLeapYear&#40;dkGregorian, Year.value - 1&#41;;

Days = DaysToDate&#40;dkGregorian, Year.value, Month.value, Day.value&#41;;

Year.value -= 622;

if &#40;IsLeapYear&#40;dkSolar, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevGregorianLeap && &#40;LeapDay == 1&#41;&#41; Days += 287

else Days += 286;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkSolar, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



function SolarToGregorian&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevSolarLeap, Result;

if &#40;IsDateValid&#40;dkSolar, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevSolarLeap = IsLeapYear&#40;dkSolar, Year.value - 1&#41;;

Days = DaysToDate&#40;dkSolar, Year.value, Month.value, Day.value&#41;;

Year.value += 621;

if &#40;IsLeapYear&#40;dkGregorian, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevSolarLeap && &#40;LeapDay = 1&#41;&#41; Days += 80

else Days += 79;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkGregorian, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



var MonthNames = new Array&#40;&#41;;

var WeekDayNames = new Array&#40;&#41;;

var MonthDayNames = new Array&#40;&#41;;

MonthNames = &#91;&#34;فروردین&#34;, &#34;اردیبهشت&#34;, &#34;خرداد&#34;, &#34;تیر&#34;, &#34;مرداد&#34;, &#34;شهریور&#34;, &#34;مهر&#34;, &#34;آبان&#34;, &#34;آذر&#34;, &#34;دی&#34;, &#34;بهمن&#34;, &#34;اسفند&#34;&#93;;

WeekDayNames = &#91;&#34;یکشنبه&#34;, &#34;دوشنبه&#34;, &#34;سه شنبه&#34;, &#34;چهار شنبه&#34;, &#34;پنج شنبه&#34;, &#34;جمعه&#34;, &#34;شنبه&#34;&#93;;

MonthDayNames = &#91;&#34;اول&#34;, &#34;دوم&#34;, &#34;سوم&#34;, &#34;چهارم&#34;, &#34;پنجم&#34;, &#34;ششم&#34;, &#34;هفتم&#34;, &#34;هشتم&#34;, &#34;نهم&#34;, &#34;دهم&#34;, &#34;یازدهم&#34;, &#34;دوازدهم&#34;, &#34;سیزدهم&#34;, &#34;چهاردهم&#34;, &#34;پانزدهم&#34;, &#34;شانزدهم&#34;, &#34;هفدهم&#34;, &#34;هجدهم&#34;, &#34;نوزدهم&#34;, &#34;بیستم&#34;, &#34;بیست و یکم&#34;, &#34;بیست و دوم&#34;, &#34;بیست و سوم&#34;, &#34;بیست و چهارم&#34;, &#34;بیست و پنجم&#34;, &#34;بیست و ششم&#34;, &#34;بیست و هفتم&#34;, &#34;بیست و هشتم&#34;, &#34;بیست و نهم&#34;, &#34;سی ام&#34;, &#34;سی و یکم&#34;&#93;;



function ConvertStr&#40;DateStr, Format&#41;

&#123;

var Result;

var ObjDate = new Date&#40;&#41;;

var SplDate = DateStr.split&#40;&#34;/&#34;&#41;;

var M = new Integer&#40;parseInt&#40;SplDate&#91;0&#93;&#41;&#41;;

var D = new Integer&#40;parseInt&#40;SplDate&#91;1&#93;&#41;&#41;;

var Y = new Integer&#40;parseInt&#40;SplDate&#91;2&#93;&#41;&#41;;

ObjDate.setFullYear&#40;Y.value&#41;;

ObjDate.setMonth&#40;M.value - 1&#41;;

ObjDate.setDate&#40;D.value&#41;;

var W = ObjDate.getDay&#40;&#41;;



if &#40;GregorianToSolar&#40;Y, M, D&#41;&#41;

switch &#40;Format&#41;

&#123;

case 0&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 1&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 2&#58;

Result = &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 3&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 4&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

case 5&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 6&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 7&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 8&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 9&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

default&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

&#125;

else

Result = &#34;Error converting date.&#34;;

return Result;

&#125;



function ConvertDateTag&#40;DateStr, Format&#41;

&#123;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + ConvertStr&#40;DateStr, Format&#41; + &#34;&#60;/div&#62;&#34;;

&#125;



function ConvertArchiveTag&#40;DatesStr, Format&#41;

&#123;

var Dates = new Array&#40;&#41;;

Dates = DatesStr.split&#40;&#34;-&#34;&#41;;

var Result = ConvertStr&#40;Dates&#91;0&#93;, Format&#41; + &#34; - &#34; + ConvertStr&#40;Dates&#91;1&#93;, Format&#41;;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + Result + &#34;&#60;/div&#62;&#34;;

&#125;

// --&#62;

&#60;/script&#62;











&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

document.write&#40;ConvertDateTag&#40;&#34;&#60;$BlogDateHeaderDate$&#62;&#34;, 0&#41;&#41;;

// --&#62;

&#60;/script&#62;[/code:1]

در متن قالب <$BlogDateHeaderDate$> را بیابید.
<$BlogDateHeaderDate$> را پاک کرده و متن زیر را جایگزینش کنید.

[code:1]&#60;script language=&#34;JavaScript&#34;&#62;

&#60;!--

document.write&#40;ConvertDateTag&#40;&#34;&#60;$BlogDateHeaderDate$&#62;&#34;, 0&#41;&#41;;

// --&#62;

&#60;/script&#62;[/code:1]

در متن بالا به جای عدد صفر، هر عددی بین 0 تا 9 می توانید قرار دهید. شماره ها طبق جدول زیر، تعیین کنندهء قالب نمایش تاریخ خواهند بود.
[code:1]

0&#41; 25/10/1381

1&#41; 25/10/81

2&#41; 25 دی 1381

3&#41; بیست و پنجم دی 1381

4&#41; بیست و پنجم دی ماه 1381

5&#41; چهار شنبه، 25/10/1381

6&#41; چهار شنبه، 25/10/81

7&#41; چهار شنبه، 25 دی 1381

8&#41; چهار شنبه، بیست و پنجم دی 1381

9&#41; چهار شنبه، بیست و پنجم دی ماه 1381[/code:1]

حالا برويد سراغ آرشيو تمپليت رو كيليك كنيد و عينا اين رو كپي كنيد توي تمپليت

[code:1]

var dkSolar = 0;

var dkGregorian = 1;



var DaysOfMonths = new Array&#40;&#41;;

var LeapMonth = new Array&#40;&#41;;

var DaysToMonth = new Array&#40;&#41;;



DaysOfMonths = &#91;&#91;31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29&#93;, &#91;31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31&#93;&#93;;

LeapMonth = &#91;12, 2&#93;;

DaysToMonth = &#91;&#91;0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365&#93;, &#91;0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365&#93;&#93;;



function Integer&#40;val&#41;

&#123;

this.value = val;

&#125;



function IsLeapYear&#40;DateKind, Year&#41;

&#123;

if &#40;DateKind == dkSolar&#41;

return &#40;&#40;&#40;&#40;Year + 38&#41; * 31&#41; % 128&#41; &#60;= 30&#41;;

else

return &#40;&#40;&#40;Year % 4&#41; == 0&#41; && &#40;&#40;&#40;Year % 100&#41; != 0&#41; || &#40;&#40;Year % 400&#41; == 0&#41;&#41;&#41;;

&#125;



function DaysOfMonth&#40;DateKind, Year, Month&#41;

&#123;

var Result;

if &#40;&#40;Year != 0&#41; && &#40;&#40;Month &#60;= 12&#41; && &#40;Month &#62;= 1&#41;&#41;&#41;

&#123;

Result = DaysOfMonths&#91;DateKind&#93;&#91;Month - 1&#93;;

if &#40;&#40;Month == LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function IsDateValid&#40;DateKind, Year, Month, Day&#41;

&#123;

return &#40;&#40;Year!= 0&#41; && &#40;Month &#62;= 1&#41; && &#40;Month &#60;= 12&#41; && &#40;Day &#62;= 1&#41; && Day &#60;= &#40;DaysOfMonth&#40;DateKind, Year, Month&#41;&#41;&#41;;

&#125;



function DaysToDate&#40;DateKind, Year, Month, Day&#41;

&#123;

var Result;

if &#40;IsDateValid&#40;DateKind, Year, Month, Day&#41;&#41;

&#123;

Result = DaysToMonth&#91;DateKind&#93;&#91;Month - 1&#93; + Day;

if &#40;&#40;Month &#62; LeapMonth&#91;DateKind&#93;&#41; && IsLeapYear&#40;DateKind, Year&#41;&#41; Result++;

&#125;

else

Result = 0;

return Result;

&#125;



function DateOfDay&#40;DateKind, Days, Year, Month, Day&#41;

&#123;

var LeapDay = 0;

Month.value = 0;

Day.value = 0;

for &#40;var m = 2; m &#60;= 13; m++&#41;

&#123;

if &#40;&#40;m &#62; LeapMonth&#91;DateKind&#93;&#41; && &#40;IsLeapYear&#40;DateKind, Year&#41;&#41;&#41; LeapDay = 1;

if &#40;Days &#60;= &#40;DaysToMonth&#91;DateKind&#93;&#91;m - 1&#93; + LeapDay&#41;&#41;

&#123;

Month.value = m - 1;

if &#40;Month.value &#60;= LeapMonth&#91;DateKind&#93;&#41; LeapDay = 0;

Day.value = Days - &#40;DaysToMonth&#91;DateKind&#93;&#91;Month.value - 1&#93; + LeapDay&#41;;

break;

&#125;

&#125;

return IsDateValid&#40;DateKind, Year, Month.value, Day.value&#41;;

&#125;



function GregorianToSolar&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevGregorianLeap, Result;

if &#40;IsDateValid&#40;dkGregorian, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevGregorianLeap = IsLeapYear&#40;dkGregorian, Year.value - 1&#41;;

Days = DaysToDate&#40;dkGregorian, Year.value, Month.value, Day.value&#41;;

Year.value -= 622;

if &#40;IsLeapYear&#40;dkSolar, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevGregorianLeap && &#40;LeapDay == 1&#41;&#41; Days += 287

else Days += 286;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkSolar, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



function SolarToGregorian&#40;Year, Month, Day&#41;

&#123;

var LeapDay, Days, PrevSolarLeap, Result;

if &#40;IsDateValid&#40;dkSolar, Year.value, Month.value, Day.value&#41;&#41;

&#123;

PrevSolarLeap = IsLeapYear&#40;dkSolar, Year.value - 1&#41;;

Days = DaysToDate&#40;dkSolar, Year.value, Month.value, Day.value&#41;;

Year.value += 621;

if &#40;IsLeapYear&#40;dkGregorian, Year.value&#41;&#41; LeapDay = 1

else LeapDay = 0;

if &#40;PrevSolarLeap && &#40;LeapDay = 1&#41;&#41; Days += 80

else Days += 79;

if &#40;Days &#62; &#40;365 + LeapDay&#41;&#41;

&#123;

Year.value++;

Days -= &#40;365 + LeapDay&#41;;

&#125;

Result = DateOfDay&#40;dkGregorian, Days, Year.value, Month, Day&#41;;

&#125;

else Result = false;

return Result;

&#125;



var MonthNames = new Array&#40;&#41;;

var WeekDayNames = new Array&#40;&#41;;

var MonthDayNames = new Array&#40;&#41;;

MonthNames = &#91;&#34;فروردین&#34;, &#34;اردیبهشت&#34;, &#34;خرداد&#34;, &#34;تیر&#34;, &#34;مرداد&#34;, &#34;شهریور&#34;, &#34;مهر&#34;, &#34;آبان&#34;, &#34;آذر&#34;, &#34;دی&#34;, &#34;بهمن&#34;, &#34;اسفند&#34;&#93;;

WeekDayNames = &#91;&#34;یکشنبه&#34;, &#34;دوشنبه&#34;, &#34;سه شنبه&#34;, &#34;چهار شنبه&#34;, &#34;پنج شنبه&#34;, &#34;جمعه&#34;, &#34;شنبه&#34;&#93;;

MonthDayNames = &#91;&#34;اول&#34;, &#34;دوم&#34;, &#34;سوم&#34;, &#34;چهارم&#34;, &#34;پنجم&#34;, &#34;ششم&#34;, &#34;هفتم&#34;, &#34;هشتم&#34;, &#34;نهم&#34;, &#34;دهم&#34;, &#34;یازدهم&#34;, &#34;دوازدهم&#34;, &#34;سیزدهم&#34;, &#34;چهاردهم&#34;, &#34;پانزدهم&#34;, &#34;شانزدهم&#34;, &#34;هفدهم&#34;, &#34;هجدهم&#34;, &#34;نوزدهم&#34;, &#34;بیستم&#34;, &#34;بیست و یکم&#34;, &#34;بیست و دوم&#34;, &#34;بیست و سوم&#34;, &#34;بیست و چهارم&#34;, &#34;بیست و پنجم&#34;, &#34;بیست و ششم&#34;, &#34;بیست و هفتم&#34;, &#34;بیست و هشتم&#34;, &#34;بیست و نهم&#34;, &#34;سی ام&#34;, &#34;سی و یکم&#34;&#93;;



function ConvertStr&#40;DateStr, Format&#41;

&#123;

var Result;

var ObjDate = new Date&#40;&#41;;

var SplDate = DateStr.split&#40;&#34;/&#34;&#41;;

var M = new Integer&#40;parseInt&#40;SplDate&#91;0&#93;&#41;&#41;;

var D = new Integer&#40;parseInt&#40;SplDate&#91;1&#93;&#41;&#41;;

var Y = new Integer&#40;parseInt&#40;SplDate&#91;2&#93;&#41;&#41;;

ObjDate.setFullYear&#40;Y.value&#41;;

ObjDate.setMonth&#40;M.value - 1&#41;;

ObjDate.setDate&#40;D.value&#41;;

var W = ObjDate.getDay&#40;&#41;;



if &#40;GregorianToSolar&#40;Y, M, D&#41;&#41;

switch &#40;Format&#41;

&#123;

case 0&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 1&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 2&#58;

Result = &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 3&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 4&#58;

Result = &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

case 5&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

case 6&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + D.value + &#34;/&#34; + M.value + &#34;/&#34; + &#40;Y.value - Math.floor&#40;Y.value / 100&#41; * 100&#41;;

break;

case 7&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;D.value + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 8&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; &#34; + Y.value&#41;;

break;

case 9&#58;

Result = WeekDayNames&#91;W&#93; + &#34;، &#34; + &#40;MonthDayNames&#91;D.value - 1&#93; + &#34; &#34; + MonthNames&#91;M.value - 1&#93; + &#34; ماه &#34; + Y.value&#41;;

break;

default&#58;

Result = D.value + &#34;/&#34; + M.value + &#34;/&#34; + Y.value;

break;

&#125;

else

Result = &#34;Error converting date.&#34;;

return Result;

&#125;



function ConvertDateTag&#40;DateStr, Format&#41;

&#123;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + ConvertStr&#40;DateStr, Format&#41; + &#34;&#60;/div&#62;&#34;;

&#125;



function ConvertArchiveTag&#40;DatesStr, Format&#41;

&#123;

var Dates = new Array&#40;&#41;;

Dates = DatesStr.split&#40;&#34;-&#34;&#41;;

var Result = ConvertStr&#40;Dates&#91;0&#93;, Format&#41; + &#34; - &#34; + ConvertStr&#40;Dates&#91;1&#93;, Format&#41;;

return &#34;&#60;div align=right dir=rtl&#62;&#34; + Result + &#34;&#60;/div&#62;&#34;;

&#125;





&#60;Blogger&#62;

document.write&#40;&#34;&#60;a href='&#60;$BlogArchiveLink$&#62;'&#62;&#34;&#41;

document.write&#40;ConvertArchiveTag&#40;'&#60;$BlogArchiveName$&#62;'&#41;&#41;

document.write&#40;&#34;&#60;/a&#62;&#34;&#41;

&#60;/Blogger&#62;

if &#40;location.href.indexOf&#40;&#34;archive&#34;&#41; != -1&#41; &#123;

document.write&#40;&#34;&#60;a href=&#34;./&#34;&#62;current&#60;/a&#62;&#34;&#41;

&#125; [/code:1]

تغییرات را ذخیره کرده و به صفحهء اصلی بازگردید.
تمام پستها و آرشیوهایتان را دوباره Publish نمایید.

اکنون تاریخهای وبلاگ شما باید شمسی و فارسی شده باشد. اگر نشده، احتمالا در یکی از گامها اشتباه کرده اید. یک بار دیگر گامها را کنترل کنید.

با تشكر از
گوگل!
محمود شفیعی زرگر و وبلاگش:
راهنمای گام به گام استفاده از تاریخ شمسی.
htm
احسان براي كامل كردن قسمت آرشيو
و خودم جمع آوري و نقل قول :D

اين رو خودم تست كردم همه جوره درست هستش بهترين روشيه كه پيدا كردم جدا
فكر نمي كنم ديگه راجع به اين قضيه براي كسي سوالي پيش بياد اگر بود از احسان بپرسيد به تره:)
 

Mashaheer

مدیر بازنشسته
کاربر فعال
تاریخ عضویت
5 می 2003
نوشته‌ها
1,992
لایک‌ها
17
سن
43
محل سکونت
UAE
سلام وبلاگر جان
من در وبلاگ بلغان تولز در اين رابطه به صورت مفصل نوشتم مي تونيد به آنجا مراجعه كنيد. (با توجه به موضوع بحث شده در پرشين تولز نوشته شده) لينك مقاله هم:
<a href='http://tools.bolghan.com/archives/000074.html' target='_blank'>http://tools.bolghan.com/archives/000074.html</a>
موفق باشيد.
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
اول بگم كه مشاهير جان سلام
دوم بگم دستت درد نكنه مال تو كامل تر بود
سوم بگم كه چرا پس من انقدر خودم رو زدم به در ديوار رفتي قايم شدي لينك رو ندادي :( مي دوني چقدر وقتم رو گرفت
چهارم اين كه به اسم 2 تاييمون ثبتش مي كنيم كه نه سيخ بسوزه نه لوبيا :D
 

Mashaheer

مدیر بازنشسته
کاربر فعال
تاریخ عضویت
5 می 2003
نوشته‌ها
1,992
لایک‌ها
17
سن
43
محل سکونت
UAE
سلام وبلاگر جان
شرمنده كه من دير اين مطلب رو جواب دادم من اينو نديده بودم ، بعد اينكه من زياد آنلاين نمي شوم. من تاجايي كه بدونم كمك خواهم كرد و اگر هم ندونستم سعي مي كنم پارازيت نياندازم تا ديگر دوستان جواب بدهند. بعد اگر به وبلاگ بلغان تولز (http://tools.bolghan.com) هم سر بزنيد من مطالب اينجا رو به صورت دسته بندي و خلاصه مي نويسم. (تقريبا هفته يكبار)
موفق باشيد
 

weblogger

Registered User
تاریخ عضویت
24 دسامبر 2002
نوشته‌ها
506
لایک‌ها
6
من مشكل پيدا كردم دوباره با اين تاريخ مي تونيد كمكم كنيداينجا روببينيد تاريخ آرشيو چطوري شده و يك چيزه ديگه من نمي تونم 2 تا تاريخ شمسي و ميلادي رو با هم داشته باشم ؟ چون وقتي از هر 2 تاش استفاده مي كنم ديگه آرشيو رو نشون نمي ده يه مقدار گيج شددم
 

ehsan

Administrator
مدیر انجمن
Administrator
تاریخ عضویت
5 دسامبر 2002
نوشته‌ها
7,949
لایک‌ها
3,918
محل سکونت
Internet
يه لينك هم بزار وبلاگر جان
 
بالا