How to get start and end date for a specific month and year

前端 未结 3 1239
青春惊慌失措
青春惊慌失措 2021-01-24 06:26

I am creating a report in iReport

The user enters a date eg. 2014-09-14

The report then needs to print 2014-09-01 and 2014-09-30

(\"First day of

3条回答
  •  孤街浪徒
    2021-01-24 06:56

    I got it working by using some SQL in the query of the report and just printing that field

    SQL looks like this

    Select LAST_DAY('2014-09-14') lastDay,
    DATE_ADD((DATE_ADD(LAST_DAY('2014-09-14') ,INTERVAL 1 DAY)) ,INTERVAL -1 MONTH) firstDay
    

    Note: replace '2014-09-14'with input parameter on reprot eg. $P{dateEntered}

提交回复
热议问题