使用mysql查询使用给定的年,月,周数,dayofweek查找日期 [英] find date using given year,month,week number,dayofweek using mysql query

查看:169
本文介绍了使用mysql查询使用给定的年,月,周数,dayofweek查找日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们





如何找到指定年份,月份,周数的日期。星期几



例如:

年份:2013

月:12

周数:3
dayofweek:saturday

hi friends


How can i find the date for given year,month,week number.dayofweek

example:
year:2013
month:12
week number:3
dayofweek: saturday

推荐答案

http://blog.ysatech.com/post/2009/ 06/27 /如何获得每月给定的一周数量的日期.aspx [^] [ ^ ]


对此没有单一的答案:AFAIK周没有标准 - 普遍接受的月份 - 事实上,即使在一个国家内,定义也会有所不同,与ISO8601涵盖的每周不同。如果你看这里 [ ^ ]您将看到WOY介绍的并发症,您应该意识到这些也适用于WOM。



您必须查看年份和月份,并计算出第1天的第1天,然后继续查找所需的日期范围。但请注意 - 如果您的规则与WOY类似,那么您的某些日子可能在上个月或下个月,因为几个星期不会在本月的第一天开始。



这可能有所帮助: http://stackoverflow.com/questions/2136487/计算 - 每月净值 [ ^ ]
There is no single answer to this: AFAIK there is no standard for week-of-month which is universally accepted - in fact the definition can vary even within a single country, unlike week-of-year which is covered by ISO8601. If you look here[^] you will see what complications WOY introduces, and you should realize that these also apply to WOM.

You will have to look at the year and month and work out what week day 1 is in first, then work forward to find out which range of dates ar in the required on. Be careful though - if your rules are anything like WOY, some of your days may be in last month, or next month because weeks don't start on the first of the month.

This may help: http://stackoverflow.com/questions/2136487/calculate-week-of-month-in-net[^]


这篇关于使用mysql查询使用给定的年,月,周数,dayofweek查找日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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