在Oracle函数中获取上个月的最后一天 [英] Getting Last Day of Previous Month in Oracle Function
本文介绍了在Oracle函数中获取上个月的最后一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个 Oracle
中的函数。
当我给参数一个简单的日期。
When i giving a parameter a simple date. Then function should getting me last day of the previous month.
例如:
FunctionName(10.02.2011) Result should be 31.01.2011
FunctionName(21.03.2011) Result should be 28.02.2011
FunctionName(31.07.2011) Result should be 30.06.2011 (Even date is last day of month)
我该如何做?顺便说一句,我从来不使用 Oracle
How can i do that? By the way, i never use Oracle
.
解决方案
推荐答案
SELECT LAST_DAY(ADD_MONTHS(yourdate,-1))
这篇关于在Oracle函数中获取上个月的最后一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文