Search Postgresql Archives

Re: How can I get first day date of the previous month ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your answer. How to get the first day date of last 6 months from now then will be :

yelloday_development=# select date_trunc('month', now()) - interval '5 month' as first_month;
        first_month        
---------------------------
 2014-01-01 00:00:00+05:30
(1 row)

Is it correct ? I am new pgdql DB :-) Awesome DB it is... 
 
Regards,
Arup Rakshit


On Friday, 20 June 2014 12:22 PM, Michael Paquier <michael.paquier@xxxxxxxxx> wrote:


On Fri, Jun 20, 2014 at 3:42 PM, Arup Rakshit

<aruprakshit@xxxxxxxxxxxxxx> wrote:
> How can I get first day date of the previous month. Last day of previous
> month can be found using the answer -
> http://stackoverflow.com/a/8945281/2767755

Here is how to get the first day date of the previous month:
=# select date_trunc('month', now()) - interval '1 month' as last_month;
      last_month
------------------------
2014-05-01 00:00:00+09
(1 row)
--
Michael


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux