日期算术生成具有月份/期间和提供日期的新日期 [英] Date Arithmetic generating a new date with the months/period and the day provided
问题描述
需要生成新日期并给出日以及当前月份和当前年份,以便在指定的时间段内使用日期功能
SET JDAY = 14
SET JMONTH = 11
SET JYEAR = 2014
需要从上述个月= 11 和年= 2014
1. 期间或月份= 15 以上同时保持天= 14
使用
SET @FDATE = DATEADD(DAY,@ JDAY-1,DATEADD(月,@ CCMTH-1,DATEADD(年,@ CCYR-1900,0)))
你是如何完成的?
预计日期 14/02/2016 使用英国日期格式
谢谢
这是一个想法:在SQL Server 2008中创建日期 [ ^ ]
Need to generate a new date with the Day given and the current month and current year given, such that with the period specified the new date will be generated using the date function
SET JDAY = 14
SET JMONTH = 11
SET JYEAR = 2014
Need to generate a new date with a certain number of months from the above months=11 and year=2014
1. Period or Months =15 from the above while maintaining the day =14
using
SET @FDATE = DATEADD(DAY,@JDAY-1,DATEADD(MONTH,@CCMTH-1,DATEADD(YEAR,@CCYR-1900,0)))
How do you accomplish it?
Expected Date is 14/02/2016 using the British Date Format
Thanks
Here is an idea: Creating Date in SQL Server 2008[^]
这篇关于日期算术生成具有月份/期间和提供日期的新日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!