如何找出一个月内的星期一? [英] How to find out the number of Mondays in a month?

查看:99
本文介绍了如何找出一个月内的星期一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要计算一个月中每个工作日的数量(星期一数,星期二数等)。这在Access中是否可行?


让我看看我是否可以解释我需要这5个计数的原因。

在我们的手术室,时间被分配到不同类别的手术(一般,神经病学,儿科等),我们想比较每个类别中花费的实际分钟数与分配的分数,并且每天进行分配。周。


使问题复杂化的是,在不同的工作日分配不同的金额;例如,一般手术每天分配450分钟,但周一只分配420分钟。 Ob-Gyn在周二和周三分配450分钟,塑料在周二和周五分配240分钟,在周四分配450分钟。你明白了。


所以我可以计算出正确的每月数字。只有当我能弄清楚每个工作日在给定月份中发生了多少时才会进行分配。


任何建议都会受到赞赏,甚至包括无法在Access中完成。但是,如果这就是答案,那么我将非常感谢有关如何实现外部的提示。以这种方式我可以在Access中使用结果。


谢谢!

I need to count the number of each weekday in a month (# of Mondays, # of Tuesdays, etc.). Is this even possible in Access?

Let me see if I can explain the reason I need these 5 counts.

In our Operating Room, the time is allocated to different classes of surgeries (General, Neurology, Pediatrics, etc.), and we want to compare the actual minutes spent in each category with what was allocated, and the allocations are made per day-of-the-week.

Complicating the issue is that different amounts are allocated on different weekdays; for instance, General surgeries are allocated 450 minutes a day, except that it''s allocated only 420 minutes on Mondays. Ob-Gyn is allocated 450 minutes on Tuesdays and Wednesdays, and Plastics is allocated 240 minutes on Tuesdays and Fridays, and 450 minutes on Thursdays. You get the idea.

So I can calculate the correct "monthly" allocation only if I can figure out how many of each weekday occurs in a given month.

Any advice will be appreciated, even including "can''t be done in Access". However, if that''s the answer, I''ll be most grateful for tips about how to accomplish this "outside" in such a way that I can use the results within Access.

Thanks!

推荐答案

首先你计算多少天到达下周一需要。然后从月中的天数中减去该值。如果那个小于29,那么本月有4个星期一,否则就是5个星期一。一周中的其他日子也一样。
First you calculate how many days it takes to get to the next Monday. Then you subtract that from the amount of days in the month. If that''s less than 29, there''s 4 Mondays in the month, otherwise it''s 5 Mondays. The same goes for the other days of the week.


哦,我喜欢!但是,让我确保我理解这是如何工作的:那不是29。必须根据本月有多少天而改变?我找了一个可以给我这个号码的VBA函数,但找不到它。有吗?或者我是否必须设置一个只包含每个月天数的表(也考虑闰年)?
OOh, I like that! But let me make sure I understand how this is working: Wouldn''t that "29" have to change depending on how many days there are in the month? I looked for a VBA function that would give me that number, but couldn''t find it. Is there one? Or do I have to set up a table that just contains the number of days in each month (also thinking about leap years)?


确定一周中特定天数的例程在给定的月份可能会是这样的:
A routine to determine the number of particular days of the week in a given month might go something like this :
展开 | 选择 | Wrap | 行号


这篇关于如何找出一个月内的星期一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆