设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1834|回复: 2
打印 上一主题 下一主题

[与其它组件] 求助,有没有能计算某年某月有几个星期日,几个星期六

[复制链接]
跳转到指定楼层
1#
发表于 2007-7-30 03:38:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
有没有能计算某年某月有几个星期日,几个星期六的函数。谢谢
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2007-7-30 06:33:00 | 只看该作者
<>里面有的,搜索一下呀</P>
<>Function Rt_Day(BegDate As Variant) As Long <BR>Dim DateCnt As Variant<BR>Dim EndDays As Variant<BR>Dim IntDays As Integer<BR>        DateCnt = CDate(Format(BegDate, "yyyy-m-1"))<BR>        EndDays = DateAdd("d", -1, DateAdd("M", 1, DateCnt))<BR>        IntDays = 0<BR>  Do While DateCnt &lt;= EndDays<BR>            If Format(DateCnt, "ddd") = "Sun" Or _<BR>                          Format(DateCnt, "ddd") = "Sat" Then<BR>                   IntDays = IntDays + 1<BR>            End If<BR>    <BR>            DateCnt = DateAdd("d", 1, DateCnt)<BR>        Loop<BR>       Rt_Day = IntDays<BR>End Function<BR></P>
3#
发表于 2008-5-17 23:31:01 | 只看该作者
这个是我理解的
Private Sub 月_AfterUpdate()
Dim y As Integer
Dim y1 As Integer
Dim m As Integer
Dim m1 As Integer
Dim d As Integer
Dim d1 As Integer
Dim w As Integer
Dim wsu As Integer
Dim wsa As Integer
Dim bz As Integer


y = Me.年
m = Me.月

If m = 12 Then                    '如果是12月时

y1 = y + 1
m1 = 0

Else

y1 = y
m1 = m

End If

d = Format((y1 & "/" & m1 + 1 & "/1"), "######") - Format((y & "/" & m & "/1"), "######")  '当月天数
d1 = Format((y & "/" & m & "/1"), "w") - 1                                                 '当月1号星期几?

wsu = Int((d - 8 + d1) / 7) + IIf(d1 = 0, 2, 1)                                            '当月有几个星期日
wsa = Int((d - 7 + d1) / 7) + 1                                                            '当月有几个星期六  

Me.出勤标准 = d - wsu - wsa                                                                ,当月标准出勤天数

End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-7 08:32 , Processed in 0.085633 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表