计算本季度的最后一天 [英] Calculate the last day of the quarter

查看:80
本文介绍了计算本季度的最后一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最有效的方法是计算上一季度的最后一天?

What's the most efficient way to calculate the last day of the prior quarter?

示例:给定日期11/19/2008,我想返回9 / 30/2008。

Example: given the date 11/19/2008, I want to return 9/30/2008.

平台是SQL Server

Platform is SQL Server

推荐答案

如果@日期有日期有问题

If @Date has the date in question

Select DateAdd(day, -1, dateadd(qq, DateDiff(qq, 0, @Date), 0)) 

这篇关于计算本季度的最后一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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