You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "apache_dev@163.com" <ap...@163.com> on 2017/08/19 15:28:07 UTC

have LAST_DAY function?

Hi,


  What functions can be used to calculate the date of the end of the month  in calcite?

  Like oracle  LAST_DAY function

 



apache_dev@163.com

Re: have LAST_DAY function?

Posted by Julian Hyde <jh...@apache.org>.
There is no such function in Calcite. Feel free to log a JIRA case to add a LAST_DAY function. Contributions welcome, of course.

You could do it using a SQL expression. Given a date d, you could add a month, then subtract the day of the month (using EXTRACT). For example, start with Aug 21st; add a month becomes Sep 21st; subtract 21 days becomes Aug 31st.

Julian


> On Aug 19, 2017, at 8:28 AM, apache_dev@163.com wrote:
> 
> Hi,
> 
> 
>  What functions can be used to calculate the date of the end of the month  in calcite?
> 
>  Like oracle  LAST_DAY function
> 
> 
> 
> 
> 
> apache_dev@163.com