473,382 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Datediff needs to deliver month AND days

with datediff all I can get it to return is months or a total of the
days...

so if the difference in dates is 12 months 4 days how do I adjust the
SQL to accommodate both?

Aug 26 '05 #1
3 1378
thrilled wrote:
with datediff all I can get it to return is months or a total of the
days...

so if the difference in dates is 12 months 4 days how do I adjust the
SQL to accommodate both?


So in February/March you want to return 1 month 2 days some years
and 1 month 1 day every fourth?

You'll need to write it yourself.
--
Daniel A. Morgan
http://www.psoug.org
da******@x.washington.edu
(replace x with u to respond)
Aug 26 '05 #2
you're the best

Aug 26 '05 #3
thrilled (de******@cox.net) writes:
with datediff all I can get it to return is months or a total of the
days...

so if the difference in dates is 12 months 4 days how do I adjust the
SQL to accommodate both?


As DA Morgan pointed out, the question needs further clarification.
For instance, how many months + days are there from 2005-08-27 to
2005-04-03? From 2004-02-27 to 2005-09-03?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Aug 26 '05 #4

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

Similar topics

8
by: inamori | last post by:
I face that problems 07/01/2003 06/30/2006 ---------> it should be 3 01/01/2003 02/28/2005 --------->could i get 2 years and 2 months 01/01/2003 03/01/2005 ...
1
by: intl04 | last post by:
I'm trying to set up a query that will include a new field ('Days until completion') whose value is derived from the DateDiff function. I think I have the syntax correct but am not sure. Days...
4
by: Paolo | last post by:
I am having some problem with a Year Function. I have form on which I have 4 field which indicate dates and an additional form which sums those dates: These are the fields: YEARS...
5
by: mcbill20 | last post by:
Hello all. I have a really basic question that I hope someone has a better answer for. I apologize in advance-- I know this is probably a really basic question but I am used to Oracle rathern than...
7
by: Adrian | last post by:
I hit on this problem converting a VB.NET insurance application to C#. Age next birthday calculated from date of birth is often needed in insurance premium calculations. Originally done using...
3
by: Price Brattin | last post by:
Why is the DateDiff function in the following code returning zero? Dim FileDate, TransmissionDate as Date Dim TranDay, FileDay, DayDiff as Inteter TransmissionDate = #2/5/2006 1:57:56 PM#...
4
by: J-P-W | last post by:
Hi, I have a system that records insurance policies. If the policy is cancelled then any part of a month insured is deducted from the premium, so a policy that ran for 32 days would get a 10...
12
by: TofuTheGreat | last post by:
I did a group search and found hundreds of cases of problems with DateDiff(). I read through several dozen but they didn not apply to my situation. Not having the time to read through all of them...
2
by: muddasirmunir | last post by:
i am using vb 6 , i had place two datepicker in form now i want to calcuate differcen of month in two date for this i used the function datediff i had try it withh many syntax but getting error...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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 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.