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 1850
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*******@postg resql.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**@ravensfie ld.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 "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what...
|
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 gives
SELECT saz_title, saz_text from saz_details where saz_date =#07/06/2004#
|
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 newsgroup and others, I'm not the only one.
Its just a poorly addressed issue within ASP. So for all your poor buggers
out there that are having problems, particularly with european date formats,
here is my solution.
I have the user enter their...
|
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:
http://www.ipwebdesign.net/kaelisSpace/useful_tableSort.html
This works great except it doesn't sort my UK formatted dates
properly, and I end up with something like this:
Birth Date (dd/mm/yyyy)
|
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 those dates. I have
learned how to use this start/end function but I can't figure out how to use
it with these subreports. Right now the report opens but asks for start/end
dates for each of the five reports. Is there a way I can input one set of...
| |
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...
Otherwise, anyone know of a cheap 3rd party calendar control I could use
that would provide that ability?
Thanks,
Rachel
|
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 dd/mm/yyyy, I have found
that the dates I put in my holidays table are reversed into American dates.
So, the wrong holiday dates are subtracted from the total workdays between
the start and end dates. Is there an easy fix for this?
******Code...
|
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 list the dates
between the start and end date. Basically I am doing a day of the week
analysis and need to know which day of the week is busiest.
|
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.
1. To search for all records between 2 dates and display them in a report
2. To be able to show all records which have a selection against them made
from a combo box
3. To be able to combine the two, selecting the option from a combo and then...
|
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 upon
a file, but it ends up not being able to display the date (probably an
Windows Explorer specific issue).
(2) I'm looking for for ways to store dates and process dates (dates only).
This probably ends up as a database specific issue, so I'm...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |