如何获得即将出生的日子 [英] How to get upcoming birth days

查看:66
本文介绍了如何获得即将出生的日子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的表格中,我存储了客户的出生日期,我想在5个工作日内得到改善
使用存储过程,我使用smalldatetime数据类型存储日期
帮帮我
谢谢u

Hi,
in my table i stored birth dates of customer and i want to get upcomin 5 bdays
using stored procedure i uses smalldatetime datatype for storing date
Help me
Thank u

推荐答案

每年的生日都在同一日期,因此,实际上只有在2月29日庆祝生日的时候才有问题. >因为出生在a年.确定一年是否为a年很简单,可以很容易地用谷歌搜索.

问候,

曼弗雷德(Manfred)
A birthday is on the same date every year so you actually only have problem if one celebrates ones birthday on February the 29th because of being born in a leap year. Determining if a year is a leap year is simple and can easily be googled.

Regards,

Manfred


我不会存储即将到来的生日.只需存储实际的生日,然后就可以计算(或按照Manfred的描述实际获取)即将到来的生日.

另外请注意,根据您当地的法律法规,保存生日可能需要获得许可和/或通知当局.
I wouldn''t store the upcoming birthdays. Just store the actual birthday and then you can calculate (or actually fetch as Manfred described) the upcoming birthdays.

Also note that depending on your local laws and regulations, storing birthdays may be a subject to a permission and/or a notification to authorities.


i找到了即将到来的Bdays解决方案

i found solution for upcoming Bdays

SELECT  bDate  AS
Birthday  ,FLOOR(DATEDIFF(dd,bDate,GETDATE()) / 365.25) AS
 Age_Now  ,FLOOR(DATEDIFF(dd,bDate,GETDATE()+180) / 365.25) AS
 Age_After_this_Week
 FROM   CustomerMaster WHERE 1 = (FLOOR(DATEDIFF(dd,bDate,GETDATE()+180) / 365.25))
    -           (FLOOR(DATEDIFF(dd,bDate,GETDATE()) / 365.25))



注意-即将开始的6个月内获得180天的生日

感谢您的支持



Note- 180 for get bdays from upcoming 6 months

thanks for support


这篇关于如何获得即将出生的日子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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