I will set one date variable(Say \'08-JUN-2011\') and I want to do some calculations based on that date namely,
1. Have to get the first day of the given day\'s month.
Using dateutils' dround tool:
Current month:
$ dround today -1
2014-02-01
Previous month
$ dround today -31
2014-01-31
Last day of current month:
$ dround today +31
2014-02-28
Of course you can use a custom date instead of today
, the idea is to round down or up to the desired day-of-the month, e.g. the next first-of-the-month given 2010-10-04:
$ dround 2010-10-04 +1d
2010-11-01