WeekDay Function
The WeekDay function returns an integer from 1 to 7 that
represents the day of the week for the specified date.
Syntax
Weekday(date[,firstdayofweek])
Parameter Description
• Date, a Required Parameter. The Week day would be returns
for this specified date.
• firstdayofweek, an Optional Parameter. Specifies the first day of the week..
o 0 = vbUseSystemDayOfWeek - Use National Language Support (NLS) API setting
o 1 = vbSunday - Sunday
o 2 = vbMonday - Monday
o 3 = vbTuesday - Tuesday
o 4 = vbWednesday - Wednesday
o 5 = vbThursday - Thursday
o 6 = vbFriday - Friday
o 7 = vbSaturday - Saturday
Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
document.write("Line 1: " & Weekday("2013-05-16",1) & "<br />")
document.write("Line 2: " & Weekday("2013-05-16",2) & "<br />")
document.write("Line 3: " & Weekday("2013-05-16",2) & "<br />")
document.write("Line 4: " & Weekday("2010-02-16") & "<br />")
document.write("Line 5: " & Weekday("2010-02-17") & "<br />")
document.write("Line 6: " & Weekday("2010-02-18") & "<br />")
</script>
</body>
</html>
When you save it as .html and execute it in Internet Explorer,
then the above script will produce the following result:
Line 1: 5
Line 2: 4
Line 3: 4
Line 4: 3
Line 5: 4
Line 6: 5
No comments:
Post a Comment