From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: First day of month, last day of month
Date: Thu, 24 Apr 2008 15:15:36 +0200
Message-ID: <20080424131536.GC15397@a-kretschmer.de> (raw)
In-Reply-To: <f16f7ea00804240559y6694c19fx102e57ea4455b07d@mail.gmail.com>
References: <f16f7ea00804240559y6694c19fx102e57ea4455b07d@mail.gmail.com>
am Thu, dem 24.04.2008, um 14:59:47 +0200 mailte Nacef LABIDI folgendes:
> Hi all,
>
> I want to select data from a table according to a date column in my table. I
> want to select all the rows which have date in the current month. So is there a
> way to get from the actual date the first day and the last day of the month or
test=*# select date_trunc('month', current_date), date_trunc('month', current_date)+'1month'::interval-'1day'::interval;
date_trunc | ?column?
------------------------+------------------------
2008-04-01 00:00:00+02 | 2008-04-30 00:00:00+02
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: First day of month, last day of month
In-Reply-To: <20080424131536.GC15397@a-kretschmer.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox