Thread: Aww, sorry (last day of month)

Aww, sorry (last day of month)

From
Antti Linno
Date:
I thought, I finished that group by theme. 

What i ment was, that I have information about workers, and I have to make
report on them. Report should contain status about workers with the
restriction , that the data is about last day of the month. I use perl as
a scripting language, and how the hell should I know how many days were in
that particular month (28,29,30,31) :). If there are no means by doing it
in sql, I write a code to ask for a , mmm, special day. *sigh*
Maybe something with date_trunc?

Thanx for discussion though.

Antti,
greetings from estionia :P




Re: Aww, sorry (last day of month)

From
Thomas Lockhart
Date:
> What i ment was, that I have information about workers, and I have to make
> report on them. Report should contain status about workers with the
> restriction , that the data is about last day of the month. I use perl as
> a scripting language, and how the hell should I know how many days were in
> that particular month (28,29,30,31) :). If there are no means by doing it
> in sql, I write a code to ask for a , mmm, special day. *sigh*
> Maybe something with date_trunc?

Someone else had the suggestion, but specifically something like
 ... where d1 >= (date_trunc('month', timestamp 'today') - interval '1
day')      and d1 < date_trunc('month', timestamp 'today');

should get you data for the previous month. Substitute the "today" field
for something else as you may require.
                       - Thomas