SQL Query to find the last day of the month

前端 未结 14 1823
太阳男子
太阳男子 2020-11-27 04:40

I need to find the last day of a month in the following format:

\"2013-05-31 00:00:00:000\"

Anybody please help out.

14条回答
  •  伪装坚强ぢ
    2020-11-27 05:13

    Just a different version of adding a month and subtracting a day for creating reports:

    ex: StartofMonth is '2019-10-01'

    dateadd(day,-1,dateadd(month,1,StartofMonth))

    EndOfMonth will become '2019-10-31'

提交回复
热议问题