הפונקציה מקבלת את התאריך והשעה בפורמט Date/Time ואת מספר שעות ההבדל הקיימות בין הארץ בה נמצא השרת לבין ארצנו ומציגה את השעה הנכונה בצורה האירופאית כאשר כל סיפרה חד ספרתית מוצגת עם הספרה 0 לפניה לדוגמא: 12/02/2005 11:40:35 ישתנה ל: 12/02/2005 11:40:35 שימו לב שאם היה מדובר בשרת בחו"ל כמו של Brinkster הפונקציה היתה דואגת להראות את התאריך בצורה האירופאית.
קוד המקור<%
function achshav(the_date,hours)
if Len(month(the_date)) = 1 Then
hodesh = "0" & month(the_date)
else
hodesh = month(the_date)
end if
if Len(day(the_date)) = 1 Then
yom = "0" & day(the_date)
else
yom = day(the_date)
end if
if Len(minute(the_date)) = 1 Then
daka = "0" & minute(the_date)
else
daka = minute(the_date)
end if
if Len(second(the_date)) = 1 Then
shnia = "0" & second(the_date)
else
shnia = second(the_date)
end if
shaha = hour(the_date) + hours
if Len(shaha) = 1 Then shaha = "0" & shaha
achshav=yom &"/"& hodesh &"/"& year(the_date) &" "& shaha &":"& daka &":"& shnia
End Function
%>
דוגמא לשימוש בפונקציה: Response.Write achshav(now,-8)
|