zoukankan      html  css  js  c++  java
  • 获取某一日期所在月份的第一天日期或最后一天日期

    获取指定日期所属月份的第一天日期:

    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- =============================================
    -- Author:      Insus.NET
    -- Create date: 2019-05-09
    -- Update date: 2019-05-09
    -- Description: 获取指定日期所属月份的第一天日期
    -- =============================================
    ALTER FUNCTION [dbo].[svf_FirstDayOfTheMonth]
    ( 
        @TheDate DATETIME 
    )
    RETURNS DATETIME
    AS
    BEGIN
        RETURN  DATEADD(MONTH,DATEDIFF(MONTH,0,@TheDate),0)  
    END
    
    GO
    Source Code

    获取指定日期所属月份的最后一天日期:

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:      Insus.NET
    -- Create date: 2019-05-09
    -- Update date: 2019-05-09
    -- Description: 获取指定日期所属月份的最后一天日期
    -- =============================================
    CREATE FUNCTION [dbo].[svf_LastDayOfTheMonth] 
    ( 
        @TheDate DATETIME 
    )
    RETURNS DATETIME
    AS
    BEGIN
        RETURN DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@TheDate) + 1,0))
    END
    Source Code
  • 相关阅读:
    hdu 2147博弈找规律
    hdu 1851 巴什博弈
    hdu 1729 sg博弈
    hdu 2516博弈找规律
    (转载)博弈之SG函数
    poj 2234基础Nim博弈||sg博弈
    hdu 1730 sg博弈||nim博弈
    hdu 1847 博弈找规律
    n hdu 1760 [SG博弈]二维状态
    hdu 1849 nim博弈
  • 原文地址:https://www.cnblogs.com/insus/p/10841647.html
Copyright © 2011-2022 走看看