Insus.NET把它们写成自定义函数,再程序中直接套用即可。
前一天:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: Insus.NET -- Create date: 2019-05-15 -- Update date: 2019-05-15 -- Description: 前一天 -- ============================================= CREATE FUNCTION [dbo].[svf_TheDayBefore] ( @Date DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(d,-1,@Date) END GO
后一天:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: Insus.NET -- Create date: 2019-05-15 -- Update date: 2019-05-15 -- Description: 后一天 -- ============================================= CREATE FUNCTION [dbo].[svf_TheDayAfter] ( @Date DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(d,1,@Date) END GO
如果获取昨天或明天日期,传入今天日期进去即可: