Hi Guys,
I am in troubles with some dates.
"I need to know the difference, in days, between two
dates."
Well, if the difference is less than a month, so I
could use:
SELECT date_part('day', age(now(), mydate));
But, when it is bigger than a month, the select above
return a wrong information to me:
For instance:
intranet=# select age('30/01/2004', '01/03/2004');
age
-----------------------
@ 1 mon 2 days 1 hour
So, if I use date_part(), it would return "2 days",
not "31 days", that is what I was waiting for.
How can I get the difference, in days, between two
dates???
Thanks in advance and
Best Regards,
__________________________________________________ ____________________
Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora: http://br.yahoo.com/info/mail.html
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend 3 1828
Subtracting two dates/timestamps will return an interval. So
select now()::date - '2004-01-13'::date
returns 34.
Is this what you need?
On Feb 16, 2004, at 2:01 PM, MaRCeLO PeReiRA wrote: Hi Guys,
I am in troubles with some dates.
"I need to know the difference, in days, between two dates."
Well, if the difference is less than a month, so I could use:
SELECT date_part('day', age(now(), mydate));
But, when it is bigger than a month, the select above return a wrong information to me:
For instance:
intranet=# select age('30/01/2004', '01/03/2004'); age ----------------------- @ 1 mon 2 days 1 hour
So, if I use date_part(), it would return "2 days", not "31 days", that is what I was waiting for.
How can I get the difference, in days, between two dates???
Thanks in advance and Best Regards, __________________________________________________ ____________________
Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora: http://br.yahoo.com/info/mail.html
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
--------------------
Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114 www.ravensfield.com
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org
On Mon, 16 Feb 2004, [iso-8859-1] MaRCeLO PeReiRA wrote: "I need to know the difference, in days, between two dates."
I think date difference will work, so maybe something like:
CURRENT_DATE - mydate
which should return an integer.
SELECT date_part('day', age(now(), mydate));
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Hi Andrew, and other ones,
It was exactly what I was looking for!!
Thanks!!
Regards,
Marcelo
Ps.: This is the fastest and more efficient mailing
list in the world. Congratulations to all.
--- Andrew Rawnsley <ro**@ravensfield.com> escreveu: Subtracting two dates/timestamps will return an interval. So
select now()::date - '2004-01-13'::date
returns 34.
Is this what you need?
On Feb 16, 2004, at 2:01 PM, MaRCeLO PeReiRA wrote:
Hi Guys,
I am in troubles with some dates.
"I need to know the difference, in days, between two dates."
Well, if the difference is less than a month, so I could use:
SELECT date_part('day', age(now(), mydate));
But, when it is bigger than a month, the select above return a wrong information to me:
For instance:
intranet=# select age('30/01/2004', '01/03/2004'); age ----------------------- @ 1 mon 2 days 1 hour
So, if I use date_part(), it would return "2 days", not "31 days", that is what I was waiting for.
How can I get the difference, in days, between two dates???
Thanks in advance and Best Regards,
__________________________________________________ ____________________ Yahoo! Mail - O melhor e-mail do Brasil! Abra sua
conta agora: http://br.yahoo.com/info/mail.html
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend --------------------
Andrew Rawnsley President The Ravensfield Digital Resource Group, Ltd. (740) 587-0114 www.ravensfield.com
__________________________________________________ ____________________
Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora: http://br.yahoo.com/info/mail.html
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives? http://archives.postgresql.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Riley |
last post by:
The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the...
|
by: Alistair |
last post by:
diary_date = request.form("diary_date") - (from a populated drop down
list)
strSQL = "SELECT saz_title, saz_text from saz_details where saz_date =#" &
diary_date & "#"
a response.write...
|
by: PW |
last post by:
<rant>
Sorry guys, but I just have to whinge. Dates in ASP are a total pain in the
butt! I seem to get caught out so many times. I realise its my own fault,
but going from the posts in this...
|
by: Colin Steadman |
last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very
simple tasks anyway), and I'm in a bit of a predicament. I've used a
javascript table sorting script from here:
...
|
by: Don Sealer |
last post by:
I have a report that includes 5 different subreports. I'd like to be
able to open this report using a date function (Start Date and End Date).
I'd like all five subreports to show the data from...
|
by: Rachel Suddeth |
last post by:
Is there a way to have the non-selectable dates (those before MinDate and
after MaxDate) draw differently so my users can see right away what dates
aren't allowed? I'm not seeing it...
...
|
by: Dixie |
last post by:
I am trying to calculate the number of workdays between two dates with
regards to holidays as well. I have used Arvin Meyer's code on the Access
Web, but as I am in Australia and my date format is...
|
by: pitfour.ferguson |
last post by:
My dbase has the start date and end date of each visit. How can I ask
Access to list the day of the week of the start (easy), end (easy) and,
more importantly, the dates of the visit itself - ie...
|
by: evilcowstare via AccessMonster.com |
last post by:
Hi, I have searched the forum for answers on this and to be honest as a
novice I find it a bit confusing so apologies if it is simple.
There are some searches that I want to apply to my database....
|
by: Jim Carlock |
last post by:
(1) Does PHP provide any way to handle dates prior to 1980?
I know there's problems with Microsoft Windows NT and all Windows
NT operating systems will allow a date prior to 1980 to be placed...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |