فرض بر این است که شما کاربر سایت Blogger هستید و می خواهید تاریخهای وبلاگتان را فارسی کنید. گامهای زیر را یک به یک دنبال کنید:
به سایت بلاگر رفته و Login کنید و به صفحهء اصلی ویرایش وبلاگ مورد نظر بروید.
با فشردن دکمهء Settings از نوار ابزار بالای صفحه به بخش تنظیمات وبلاگ بروید.
قالب نمایش تاریخ را به m/d/yyyy تغییر دهید. در این حال تاریخ بدین صورت نمایش داده خواهد شد: 2002/30/12
تغییرات را ذخیره کرده و به صفحهء اصلی بازگردید. (این کار به طور خودکار انجام خواهد شد.)
دکمهء Template را از نوار ابزار انتخاب کنید تا به صفحهء تغییر قالب هدایت شوید.
در متن قالبی که می بینید، <head> و <head/> را بیابید. (بزرگ و کوچک بودن حروف اهمیتی ندارد.)
كل كدهاي زير رو در جايي پس از <head> و پیش از <head/> کپی کنید.
[code:1]<script language="JavaScript">
<!--
<!--
// -->
/********************************************************************************/
/* */
/* solar.js - Solar Date Utility Functions */
/* Copyright(C) 2002-2003 Mahmood Shafiee Zargar, all rights reserved. */
/* */
/*
[email protected] */
/* http://sobh.netfirms.com */
/* */
/* Original Pascal Code By Kambiz R. Khojaste */
/* */
/* This file is provided "AS IS" without any warranty of any kind, either */
/* express or implied. The entire risk as to the quality and performance */
/* of the functions provided in this unit are with you. The author is NOT */
/* liable for any DAMAGES resulting from the use and misuse of the unit, */
/* especially he is NOT liable for DAMAGES that were caused BY ANY VERSION */
/* WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF. */
/* */
/********************************************************************************/
var dkSolar = 0;
var dkGregorian = 1;
var DaysOfMonths = new Array();
var LeapMonth = new Array();
var DaysToMonth = new Array();
DaysOfMonths = [[31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29], [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]];
LeapMonth = [12, 2];
DaysToMonth = [[0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365], [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]];
function Integer(val)
{
this.value = val;
}
function IsLeapYear(DateKind, Year)
{
if (DateKind == dkSolar)
return ((((Year + 38) * 31) % 128) <= 30);
else
return (((Year % 4) == 0) && (((Year % 100) != 0) || ((Year % 400) == 0)));
}
function DaysOfMonth(DateKind, Year, Month)
{
var Result;
if ((Year != 0) && ((Month <= 12) && (Month >= 1)))
{
Result = DaysOfMonths[DateKind][Month - 1];
if ((Month == LeapMonth[DateKind]) && IsLeapYear(DateKind, Year)) Result++;
}
else
Result = 0;
return Result;
}
function IsDateValid(DateKind, Year, Month, Day)
{
return ((Year!= 0) && (Month >= 1) && (Month <= 12) && (Day >= 1) && Day <= (DaysOfMonth(DateKind, Year, Month)));
}
function DaysToDate(DateKind, Year, Month, Day)
{
var Result;
if (IsDateValid(DateKind, Year, Month, Day))
{
Result = DaysToMonth[DateKind][Month - 1] + Day;
if ((Month > LeapMonth[DateKind]) && IsLeapYear(DateKind, Year)) Result++;
}
else
Result = 0;
return Result;
}
function DateOfDay(DateKind, Days, Year, Month, Day)
{
var LeapDay = 0;
Month.value = 0;
Day.value = 0;
for (var m = 2; m <= 13; m++)
{
if ((m > LeapMonth[DateKind]) && (IsLeapYear(DateKind, Year))) LeapDay = 1;
if (Days <= (DaysToMonth[DateKind][m - 1] + LeapDay))
{
Month.value = m - 1;
if (Month.value <= LeapMonth[DateKind]) LeapDay = 0;
Day.value = Days - (DaysToMonth[DateKind][Month.value - 1] + LeapDay);
break;
}
}
return IsDateValid(DateKind, Year, Month.value, Day.value);
}
function GregorianToSolar(Year, Month, Day)
{
var LeapDay, Days, PrevGregorianLeap, Result;
if (IsDateValid(dkGregorian, Year.value, Month.value, Day.value))
{
PrevGregorianLeap = IsLeapYear(dkGregorian, Year.value - 1);
Days = DaysToDate(dkGregorian, Year.value, Month.value, Day.value);
Year.value -= 622;
if (IsLeapYear(dkSolar, Year.value)) LeapDay = 1
else LeapDay = 0;
if (PrevGregorianLeap && (LeapDay == 1)) Days += 287
else Days += 286;
if (Days > (365 + LeapDay))
{
Year.value++;
Days -= (365 + LeapDay);
}
Result = DateOfDay(dkSolar, Days, Year.value, Month, Day);
}
else Result = false;
return Result;
}
function SolarToGregorian(Year, Month, Day)
{
var LeapDay, Days, PrevSolarLeap, Result;
if (IsDateValid(dkSolar, Year.value, Month.value, Day.value))
{
PrevSolarLeap = IsLeapYear(dkSolar, Year.value - 1);
Days = DaysToDate(dkSolar, Year.value, Month.value, Day.value);
Year.value += 621;
if (IsLeapYear(dkGregorian, Year.value)) LeapDay = 1
else LeapDay = 0;
if (PrevSolarLeap && (LeapDay = 1)) Days += 80
else Days += 79;
if (Days > (365 + LeapDay))
{
Year.value++;
Days -= (365 + LeapDay);
}
Result = DateOfDay(dkGregorian, Days, Year.value, Month, Day);
}
else Result = false;
return Result;
}
var MonthNames = new Array();
var WeekDayNames = new Array();
var MonthDayNames = new Array();
MonthNames = ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"];
WeekDayNames = ["یکشنبه", "دوشنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه", "شنبه"];
MonthDayNames = ["اول", "دوم", "سوم", "چهارم", "پنجم", "ششم", "هفتم", "هشتم", "نهم", "دهم", "یازدهم", "دوازدهم", "سیزدهم", "چهاردهم", "پانزدهم", "شانزدهم", "هفدهم", "هجدهم", "نوزدهم", "بیستم", "بیست و یکم", "بیست و دوم", "بیست و سوم", "بیست و چهارم", "بیست و پنجم", "بیست و ششم", "بیست و هفتم", "بیست و هشتم", "بیست و نهم", "سی ام", "سی و یکم"];
function ConvertStr(DateStr, Format)
{
var Result;
var ObjDate = new Date();
var SplDate = DateStr.split("/");
var M = new Integer(parseInt(SplDate[0]));
var D = new Integer(parseInt(SplDate[1]));
var Y = new Integer(parseInt(SplDate[2]));
ObjDate.setFullYear(Y.value);
ObjDate.setMonth(M.value - 1);
ObjDate.setDate(D.value);
var W = ObjDate.getDay();
if (GregorianToSolar(Y, M, D))
switch (Format)
{
case 0:
Result = D.value + "/" + M.value + "/" + Y.value;
break;
case 1:
Result = D.value + "/" + M.value + "/" + (Y.value - Math.floor(Y.value / 100) * 100);
break;
case 2:
Result = (D.value + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 3:
Result = (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 4:
Result = (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " ماه " + Y.value);
break;
case 5:
Result = WeekDayNames[W] + "، " + D.value + "/" + M.value + "/" + Y.value;
break;
case 6:
Result = WeekDayNames[W] + "، " + D.value + "/" + M.value + "/" + (Y.value - Math.floor(Y.value / 100) * 100);
break;
case 7:
Result = WeekDayNames[W] + "، " + (D.value + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 8:
Result = WeekDayNames[W] + "، " + (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 9:
Result = WeekDayNames[W] + "، " + (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " ماه " + Y.value);
break;
default:
Result = D.value + "/" + M.value + "/" + Y.value;
break;
}
else
Result = "Error converting date.";
return Result;
}
function ConvertDateTag(DateStr, Format)
{
return "<div align=right dir=rtl>" + ConvertStr(DateStr, Format) + "</div>";
}
function ConvertArchiveTag(DatesStr, Format)
{
var Dates = new Array();
Dates = DatesStr.split("-");
var Result = ConvertStr(Dates[0], Format) + " - " + ConvertStr(Dates[1], Format);
return "<div align=right dir=rtl>" + Result + "</div>";
}
// -->
</script>
<script language="JavaScript">
<!--
document.write(ConvertDateTag("<$BlogDateHeaderDate$>", 0));
// -->
</script>[/code:1]
در متن قالب <$BlogDateHeaderDate$> را بیابید.
<$BlogDateHeaderDate$> را پاک کرده و متن زیر را جایگزینش کنید.
[code:1]<script language="JavaScript">
<!--
document.write(ConvertDateTag("<$BlogDateHeaderDate$>", 0));
// -->
</script>[/code:1]
در متن بالا به جای عدد صفر، هر عددی بین 0 تا 9 می توانید قرار دهید. شماره ها طبق جدول زیر، تعیین کنندهء قالب نمایش تاریخ خواهند بود.
[code:1]
0) 25/10/1381
1) 25/10/81
2) 25 دی 1381
3) بیست و پنجم دی 1381
4) بیست و پنجم دی ماه 1381
5) چهار شنبه، 25/10/1381
6) چهار شنبه، 25/10/81
7) چهار شنبه، 25 دی 1381
8) چهار شنبه، بیست و پنجم دی 1381
9) چهار شنبه، بیست و پنجم دی ماه 1381[/code:1]
حالا برويد سراغ آرشيو تمپليت رو كيليك كنيد و عينا اين رو كپي كنيد توي تمپليت
[code:1]
var dkSolar = 0;
var dkGregorian = 1;
var DaysOfMonths = new Array();
var LeapMonth = new Array();
var DaysToMonth = new Array();
DaysOfMonths = [[31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29], [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]];
LeapMonth = [12, 2];
DaysToMonth = [[0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365], [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]];
function Integer(val)
{
this.value = val;
}
function IsLeapYear(DateKind, Year)
{
if (DateKind == dkSolar)
return ((((Year + 38) * 31) % 128) <= 30);
else
return (((Year % 4) == 0) && (((Year % 100) != 0) || ((Year % 400) == 0)));
}
function DaysOfMonth(DateKind, Year, Month)
{
var Result;
if ((Year != 0) && ((Month <= 12) && (Month >= 1)))
{
Result = DaysOfMonths[DateKind][Month - 1];
if ((Month == LeapMonth[DateKind]) && IsLeapYear(DateKind, Year)) Result++;
}
else
Result = 0;
return Result;
}
function IsDateValid(DateKind, Year, Month, Day)
{
return ((Year!= 0) && (Month >= 1) && (Month <= 12) && (Day >= 1) && Day <= (DaysOfMonth(DateKind, Year, Month)));
}
function DaysToDate(DateKind, Year, Month, Day)
{
var Result;
if (IsDateValid(DateKind, Year, Month, Day))
{
Result = DaysToMonth[DateKind][Month - 1] + Day;
if ((Month > LeapMonth[DateKind]) && IsLeapYear(DateKind, Year)) Result++;
}
else
Result = 0;
return Result;
}
function DateOfDay(DateKind, Days, Year, Month, Day)
{
var LeapDay = 0;
Month.value = 0;
Day.value = 0;
for (var m = 2; m <= 13; m++)
{
if ((m > LeapMonth[DateKind]) && (IsLeapYear(DateKind, Year))) LeapDay = 1;
if (Days <= (DaysToMonth[DateKind][m - 1] + LeapDay))
{
Month.value = m - 1;
if (Month.value <= LeapMonth[DateKind]) LeapDay = 0;
Day.value = Days - (DaysToMonth[DateKind][Month.value - 1] + LeapDay);
break;
}
}
return IsDateValid(DateKind, Year, Month.value, Day.value);
}
function GregorianToSolar(Year, Month, Day)
{
var LeapDay, Days, PrevGregorianLeap, Result;
if (IsDateValid(dkGregorian, Year.value, Month.value, Day.value))
{
PrevGregorianLeap = IsLeapYear(dkGregorian, Year.value - 1);
Days = DaysToDate(dkGregorian, Year.value, Month.value, Day.value);
Year.value -= 622;
if (IsLeapYear(dkSolar, Year.value)) LeapDay = 1
else LeapDay = 0;
if (PrevGregorianLeap && (LeapDay == 1)) Days += 287
else Days += 286;
if (Days > (365 + LeapDay))
{
Year.value++;
Days -= (365 + LeapDay);
}
Result = DateOfDay(dkSolar, Days, Year.value, Month, Day);
}
else Result = false;
return Result;
}
function SolarToGregorian(Year, Month, Day)
{
var LeapDay, Days, PrevSolarLeap, Result;
if (IsDateValid(dkSolar, Year.value, Month.value, Day.value))
{
PrevSolarLeap = IsLeapYear(dkSolar, Year.value - 1);
Days = DaysToDate(dkSolar, Year.value, Month.value, Day.value);
Year.value += 621;
if (IsLeapYear(dkGregorian, Year.value)) LeapDay = 1
else LeapDay = 0;
if (PrevSolarLeap && (LeapDay = 1)) Days += 80
else Days += 79;
if (Days > (365 + LeapDay))
{
Year.value++;
Days -= (365 + LeapDay);
}
Result = DateOfDay(dkGregorian, Days, Year.value, Month, Day);
}
else Result = false;
return Result;
}
var MonthNames = new Array();
var WeekDayNames = new Array();
var MonthDayNames = new Array();
MonthNames = ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"];
WeekDayNames = ["یکشنبه", "دوشنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه", "شنبه"];
MonthDayNames = ["اول", "دوم", "سوم", "چهارم", "پنجم", "ششم", "هفتم", "هشتم", "نهم", "دهم", "یازدهم", "دوازدهم", "سیزدهم", "چهاردهم", "پانزدهم", "شانزدهم", "هفدهم", "هجدهم", "نوزدهم", "بیستم", "بیست و یکم", "بیست و دوم", "بیست و سوم", "بیست و چهارم", "بیست و پنجم", "بیست و ششم", "بیست و هفتم", "بیست و هشتم", "بیست و نهم", "سی ام", "سی و یکم"];
function ConvertStr(DateStr, Format)
{
var Result;
var ObjDate = new Date();
var SplDate = DateStr.split("/");
var M = new Integer(parseInt(SplDate[0]));
var D = new Integer(parseInt(SplDate[1]));
var Y = new Integer(parseInt(SplDate[2]));
ObjDate.setFullYear(Y.value);
ObjDate.setMonth(M.value - 1);
ObjDate.setDate(D.value);
var W = ObjDate.getDay();
if (GregorianToSolar(Y, M, D))
switch (Format)
{
case 0:
Result = D.value + "/" + M.value + "/" + Y.value;
break;
case 1:
Result = D.value + "/" + M.value + "/" + (Y.value - Math.floor(Y.value / 100) * 100);
break;
case 2:
Result = (D.value + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 3:
Result = (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 4:
Result = (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " ماه " + Y.value);
break;
case 5:
Result = WeekDayNames[W] + "، " + D.value + "/" + M.value + "/" + Y.value;
break;
case 6:
Result = WeekDayNames[W] + "، " + D.value + "/" + M.value + "/" + (Y.value - Math.floor(Y.value / 100) * 100);
break;
case 7:
Result = WeekDayNames[W] + "، " + (D.value + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 8:
Result = WeekDayNames[W] + "، " + (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " " + Y.value);
break;
case 9:
Result = WeekDayNames[W] + "، " + (MonthDayNames[D.value - 1] + " " + MonthNames[M.value - 1] + " ماه " + Y.value);
break;
default:
Result = D.value + "/" + M.value + "/" + Y.value;
break;
}
else
Result = "Error converting date.";
return Result;
}
function ConvertDateTag(DateStr, Format)
{
return "<div align=right dir=rtl>" + ConvertStr(DateStr, Format) + "</div>";
}
function ConvertArchiveTag(DatesStr, Format)
{
var Dates = new Array();
Dates = DatesStr.split("-");
var Result = ConvertStr(Dates[0], Format) + " - " + ConvertStr(Dates[1], Format);
return "<div align=right dir=rtl>" + Result + "</div>";
}
<Blogger>
document.write("<a href='<$BlogArchiveLink$>'>")
document.write(ConvertArchiveTag('<$BlogArchiveName$>'))
document.write("</a>")
</Blogger>
if (location.href.indexOf("archive") != -1) {
document.write("<a href="./">current</a>")
} [/code:1]
تغییرات را ذخیره کرده و به صفحهء اصلی بازگردید.
تمام پستها و آرشیوهایتان را دوباره Publish نمایید.
اکنون تاریخهای وبلاگ شما باید شمسی و فارسی شده باشد. اگر نشده، احتمالا در یکی از گامها اشتباه کرده اید. یک بار دیگر گامها را کنترل کنید.
با تشكر از
گوگل!
محمود شفیعی زرگر و وبلاگش:
راهنمای گام به گام استفاده از تاریخ شمسی.
htm
احسان براي كامل كردن قسمت آرشيو
و خودم جمع آوري و نقل قول
اين رو خودم تست كردم همه جوره درست هستش بهترين روشيه كه پيدا كردم جدا
فكر نمي كنم ديگه راجع به اين قضيه براي كسي سوالي پيش بياد اگر بود از احسان بپرسيد به تره
