472,333 Members | 1,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

LAST_DAY Function in Postgres

Hi,
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.

Thanxx

Schoeib
4Tek Gesellschaft fr angewandte Informationstechnologien mbH
Schoeib Amin
Tel. +49 (0) 69 697688-132
Fax. +49 (0) 69 697688-111
http://www.4tek.de
Nov 11 '05 #1
5 8937
On 2 Sep 2003 at 15:08, Amin Schoeib wrote:
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.


While this is not a direct answer to question..

It made me think. I am sure lot of people have lot of functions written in
order to get job done. Can we have an archive of such functions, if authors are
willing to make it open.

Something like CPAN? Yeah we don't need to change that name..:-)

Bye
Shridhar

--
"...very few phenomena can pull someone out of Deep Hack Mode, with twonoted
exceptions: being struck by lightning, or worse, your *computer*being struck by
lightning."(By Matt Welsh)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #2
Hi,

if didn't find this function on
http://www.postgresql.org/docs/7.3/i...-datetime.html,
You have to write own function

testdb=> create or replace function last_day(date) returns date as 'select
cast(date_trunc(''month'', $1) + ''1 month''::interval as date) - 1'
language sql;
CREATE FUNCTION
testdb=> select last_day(current_date);
last_day
------------
2003-09-30
(1 dka)

Bye
Pavel
On Tue, 2 Sep 2003, Amin Schoeib wrote:
Hi,
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.

Thanxx

Schoeib
4Tek Gesellschaft fr angewandte Informationstechnologien mbH
Schoeib Amin
Tel. +49 (0) 69 697688-132
Fax. +49 (0) 69 697688-111
http://www.4tek.de

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #3
On Tue, 2 Sep 2003, Shridhar Daithankar wrote:
On 2 Sep 2003 at 15:08, Amin Schoeib wrote:
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.
While this is not a direct answer to question..

It made me think. I am sure lot of people have lot of functions written in
order to get job done. Can we have an archive of such functions, if authors are
willing to make it open.

Something like CPAN? Yeah we don't need to change that name..:-)


Cookbook pages?

http://www.brasileiro.net/postgres/cookbook/

Pavel
Bye
Shridhar

--
"...very few phenomena can pull someone out of Deep Hack Mode, with twonoted
exceptions: being struck by lightning, or worse, your *computer*being struck by
lightning."(By Matt Welsh)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #4
Shridhar Daithankar wrote:
On 2 Sep 2003 at 15:08, Amin Schoeib wrote:
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.


While this is not a direct answer to question..

It made me think. I am sure lot of people have lot of functions written in
order to get job done. Can we have an archive of such functions, if authors are
willing to make it open.

Something like CPAN? Yeah we don't need to change that name..:-)


There is the PostgreSQL Cookbook on the techdocs web site.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #5
I also have a small, but growing collection of *stuff*
off of the General Bits site as well as a number of
useful functions with explanations in lots of articles.

From http://www.varlena.com/GeneralBits/

Search with local google or look through tidbits
and the Archives.

--elein

On Wed, Sep 03, 2003 at 04:43:28PM -0400, Bruce Momjian wrote:
Shridhar Daithankar wrote:
On 2 Sep 2003 at 15:08, Amin Schoeib wrote:
I would like to know if there is a Function in Postgres
Like the LAST_DAY Function in Oracle??
In Oracle you can use the function the get the last day of a month.


While this is not a direct answer to question..

It made me think. I am sure lot of people have lot of functions written in
order to get job done. Can we have an archive of such functions, if authors are
willing to make it open.

Something like CPAN? Yeah we don't need to change that name..:-)


There is the PostgreSQL Cookbook on the techdocs web site.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Amin Schoeib | last post by:
Hi, Like I see there is no equivalent to the Oracle decode Function In Postgres.Is there maybe somebody who wrote decode as a Function? ...
5
by: Petr Bravenec | last post by:
I have found that when I use the RETURN NEXT command in recursive function, not all records are returned. The only records I can obtain from...
5
by: Alex Page | last post by:
I've been trying to extend Postgres and create an enumerated type to represent gender, as a precursor to more complex enumerated types. I've...
1
by: John Sidney-Woollett | last post by:
Is it possible to call a Postgres stored function (as if it were a procedure), using a PreparedStatement which will receive no return value,...
3
by: warwick.poole | last post by:
I am interested in finding out about Enterprise scale Postgres installations and clustering, especially on Linux. Essentially I would like to...
9
by: Alexander Cohen | last post by:
(sorry for the double post if there is one - i sent the mail to the lisyt from the wrong address) Hi, Im passing this in the commmand line to...
6
by: Jim Steinberger | last post by:
Hey all - my inaugural post, I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to PostgreSQL 7.3.4 running on the same...
18
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by...
3
by: Fuzzydave | last post by:
I need to call a function stored in Postgres which does a lot of the db and calculation work all the SQL queries are hardcoded in a file called...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.