确定某日在当月是第几个星期几的代码-咱家是猫
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-模块/函数/VBA


确定某日在当月是第几个星期几的代码

发表时间:2010/5/24 8:13:48 评论(0) 浏览(6802)  评论 | 加入收藏 | 复制
   
摘 要:确定某日在当月是第几个星期几的代码
正 文:

Private Function GetWeekDayStr(SolarDate As Date, m As Byte, n As Byte, w As Byte) As String
'根据日期查询是当月的第几周的周几
    Dim tempDate As Date, tempW As Integer
    tempDate = DateSerial(Year(SolarDate), Month(SolarDate), 1)
    tempW = Weekday(tempDate)
    m = Format(SolarDate, "mm")
    n = Format(SolarDate, "WW") - Format(tempDate, "WW") + 1
    w = Weekday(SolarDate)
    If tempW > w Then n = n - 1
   
End Function
Sub test()
    Dim d As Date, m As Byte, n As Byte, w As Byte
    d = #1/18/2009#
    Call GetWeekDayStr(d, m, n, w)
    Debug.Print d & "是" & m & "月的第" & n & "个" & WeekdayName(w)
End Sub

Access软件网交流QQ群(群号:198465573)
 
 相关文章
确定某日在当月是第几个星期几的代码  【咱家是猫  2010/5/24】
【access自定义函数】统计某一个时间段内有多少个星期几\自定义...  【叶海峰  2012/2/28】
【Access入门】英文显示星期几,英文星期几,英文星期的示例  【麥田  2012/10/19】
【Access入门】中文显示星期几,中文星期几,中文星期的示例  【麥田  2012/10/20】
常见问答
技术分类
相关资源
文章搜索
关于作者

咱家是猫

文章分类

文章存档

友情链接