Knowledge Transfer

Thursday, November 15, 2007

RFC822_Date Format For RSS and Normal Dates in ASP,.Net,JSP Formats

The Date Formats are Different like dd/mm/yyyy,mm/dd,yyyy, like that some Date Formats are Different.

This is RFC822 Format date Code For Using in RSS Feed.

In ASP Code:
call return_RFC822_Date(NOW(),"GMT")

The Function For Geeting RFC822 Format :


Function return_RFC822_Date(myDate, offset)
Dim myDay, myDays, myMonth, myYear
Dim myHours, myMonths, mySeconds

myDate = CDate(myDate)
myDay = WeekdayName(Weekday(myDate),true)
myDays = Day(myDate)
myMonth = MonthName(Month(myDate), true)
myYear = Year(myDate)
myHours = zeroPad(Hour(myDate), 2)
myMinutes = zeroPad(Minute(myDate), 2)
mySeconds = zeroPad(Second(myDate), 2)

return_RFC822_Date = myDay&", "& _
myDays&" "& _
myMonth&" "& _
myYear&" "& _
myHours&":"& _
myMinutes&":"& _
mySeconds&" "& _
offset
End Function
Function zeroPad(m, t)
zeroPad = String(t-Len(m),"0")&m
End Function


Enjoy the Coding.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home