会员登录 - 用户注册 - 网站地图 Office中国(office-cn.net),专业Office论坛
当前位置:主页 > 技巧 > Excel技巧 > 编程 > 正文

日期改为显示星期几的自定义涵数

时间:2006-10-22 22:17 来源:Access开发者 作者:未知 阅读:

Function DateOfWeek(ByVal Yearf As Integer, ByVal Weekf As Integer, Optional ByVal Dayf As Integer = 1, Optional ByVal FirstDayOfWeek As Integer = 0)
On Error GoTo ext
Dim fd As Date, fw%
fd = DateValue(Yearf & "-1-1")
fw = Weekday(fd)
FirstDayOfWeek = FirstDayOfWeek Mod 7
DateOfWeek = fd + 7 * (Weekf - 1) + Dayf - IIf(Weekf = 1, 1, fw - FirstDayOfWeek)
Exit Function
ext:
DateOfWeek = "#N/A"
End Function

(责任编辑:admin)

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价: