Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: First day o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 15 Topic 3430 of 3631
Post > Topic >>

Re: First day of month, last day of month

by nacef.l@[EMAIL PROTECTED] ("Nacef LABIDI") Apr 24, 2008 at 04:43 PM

------=_Part_12239_30928979.1209048220838
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Actually I want to select all rows whith dates between first day of the
month 00:00:00 and last date of the month 23:59:59

On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee <cww@[EMAIL PROTECTED]
>
wrote:

> Frank Bax wrote:
>
> > Frank Bax wrote:
> >
> > > Nacef LABIDI wrote:
> > >
> > > > is there a better method to retrieve all the rows with dates in
the
> > > > current month.
> > > >
> > >
> > > select * from mytable where extract(month from mydate) =
extract(month
> > > from now()) and extract(year from mydate) = extract(year from
now());
> > >
> >
> > Sorry; I was not thinking clearly - date_trunc is better for this:
> >
> > select * from mytable where date_trunc('month',mydate) =
> > date_trunc('month',now());
> >
>
> I have some code that uses extract() for this sort of thing.  Would you
> mind explaining how date_trunc() is better for this?
>
> Most of my extract() results end up in <select> drop-down boxes in HTML.
>
> Thanks.
>
> Colin
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

------=_Part_12239_30928979.1209048220838
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Actually I want to select all rows whith dates between first day of the
month 00:00:00 and last date of the month 23:59:59<br><br><div
class="gmail_quote">On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee
&lt;<a href="mailto:cww@[EMAIL PROTECTED]
">cww@[EMAIL PROTECTED]
>&gt;
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Frank Bax
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
Frank Bax wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;"><div class="Ih2E3d">
Nacef LABIDI wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
is there a better method to retrieve all the rows with dates in the
current month.<br>
</blockquote>
<br></div>
select * from mytable where extract(month from mydate) = extract(month
from now()) and extract(year from mydate) = extract(year from now());<br>
</blockquote>
<br>
Sorry; I was not thinking clearly - date_trunc is better for this:<br>
<br>
select * from mytable where date_trunc(&#39;month&#39;,mydate) =
date_trunc(&#39;month&#39;,now());<br>
</blockquote>
<br>
I have some code that uses extract() for this sort of thing. &nbsp;Would
you mind explaining how date_trunc() is better for this?<br>
<br>
Most of my extract() results end up in &lt;select&gt; drop-down boxes in
HTML.<br>
<br>
Thanks.<br>
<br>
Colin<br><font color="#888888">
<br>
<br>
-- <br>
Sent via pgsql-sql mailing list (<a href="mailto:pgsql-sql@[EMAIL PROTECTED]
"
target="_blank">pgsql-sql@[EMAIL PROTECTED]
>)<br>
To make changes to your subscription:<br>
<a href="http://www.postgresql.org/mailpref/pgsql-sql"
target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><br>
</font></blockquote></div><br>

------=_Part_12239_30928979.1209048220838--
 




 15 Posts in Topic:
First day of month, last day of month
nacef.l@[EMAIL PROTECTED]  2008-04-24 14:59:47 
Re: First day of month, last day of month
fbax@[EMAIL PROTECTED] (  2008-04-24 09:06:25 
Re: First day of month, last day of month
fbax@[EMAIL PROTECTED] (  2008-04-24 09:16:03 
Re: First day of month, last day of month
andreas.kretschmer@[EMAIL  2008-04-24 15:15:36 
Re: First day of month, last day of month
cww@[EMAIL PROTECTED] (C  2008-04-24 10:15:23 
Re: First day of month, last day of month
erik@[EMAIL PROTECTED] (  2008-04-24 09:41:04 
Re: First day of month, last day of month
nacef.l@[EMAIL PROTECTED]  2008-04-24 16:43:40 
Re: First day of month, last day of month
scott.marlowe@[EMAIL PROT  2008-04-24 08:55:31 
Re: First day of month, last day of month
fhevia@[EMAIL PROTECTED]   2008-04-24 12:10:34 
Re: First day of month, last day of month
scott.marlowe@[EMAIL PROT  2008-04-24 08:56:50 
Re: First day of month, last day of month
erik@[EMAIL PROTECTED] (  2008-04-24 10:08:10 
Re: First day of month, last day of month
scott.marlowe@[EMAIL PROT  2008-04-24 09:16:01 
Re: First day of month, last day of month
scott.marlowe@[EMAIL PROT  2008-04-24 09:44:44 
Re: First day of month, last day of month
fhevia@[EMAIL PROTECTED]   2008-04-24 13:07:19 
Re: First day of month, last day of month
nacef.l@[EMAIL PROTECTED]  2008-04-24 18:39:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 21 23:13:41 CDT 2008.