ASP的
<%
dim sdate,fdate,week
sdate = "20050104"
if left(sdate,4) = "2005" then
fdate = left(sdate,4)&"-"&mid(sdate,5,2)&"-"&right(sdate,2)
week = weekday(cdate(fdate))
if week = "1" then
response.Write("星期天")
else
response.Write("不是星期天")
end if
end if
%>
ASP..net的
string sdate = "20051231";
string fdate = sdate.Substring(0, 4) + "-" + sdate.Substring(4, 2) + "-" + sdate.Substring(6, 2);
if (sdate.Substring(0, 4) == "2005")
{
if (Convert.ToDateTime(fdate).DayOfWeek.ToString() == "Sunday")
{
Response.Write("星期天");
}
else
{
Response.Write("不是星期天");
}
}