Date-difference will give difference in the number of days, months, years etc. between any two calendar dates. Not defined by ISO/ANSI SQL, but several vendors have similar implementations.
Questions tagged [datediff]
1599 questions
0
votes
1 answer
updating date by stored procedure
I have a problem!
My task is to count the age of books in my library database. After that call some books as too rare, some rare , and usual using value column.
My library table ( ... , age- date , value- date)
notice: "age" - is incorrect…

Ievgenii
- 477
- 1
- 5
- 13
0
votes
2 answers
SELECT trouble with DIFFTIME
I want to know the time difference between two dates.
for example:
SELECT TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00');
+-------------------------------------------------------+
| TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00')…

fpilee
- 1,918
- 2
- 22
- 38
0
votes
1 answer
getting datediff/timespan between records
Let's say I have a basic asp.net C# web app where I enter the dates of different events, say oil changes, for example. And I want to track this for different vehicles. And then I want to calculate the difference in days between oil changes.
So for…

walstib
- 63
- 10
0
votes
1 answer
In yii how to find date is greater than current date
I am working in Yii framework. I am having Poll table with fields as-
-pollId
-pollQuestion
-Isactive
-publishDate
-isPublish
when new poll is created,that date get inserted into publishDate field.
e.g.2012-04-04 02:23:45 In this format entry get…

user1761116
- 115
- 1
- 5
- 14
0
votes
1 answer
php date_diff craziness
Can someone explain me this 'logic'?
$datetime1 = date_create('2012-04-01');
$datetime2 = date_create('2012-05-01');
$interval = date_diff($datetime1, $datetime2);
print_r($interval);
returning 0m (months) and 30d (days). But:
$datetime1 =…

Sanne
- 1,116
- 11
- 17
0
votes
0 answers
How can you find and display the difference between two dates in PHP?
Possible Duplicate:
How to calculate the difference between two dates using PHP?
Since there clearly isn't any good canonical question on the subject, and over 5000 duplicates, I fell a canonical on the subject is in order. Please tell me if you…

Madara's Ghost
- 172,118
- 50
- 264
- 308
0
votes
1 answer
DateDiff function in MYSQL 5.1. Need Hours+Mins
MYSQL 5.1
I need to create a query that gives my result table three columns, match_date, match_start and match_duration
I need the match_duration column which takes match_start and match_end and displays how long each game has been on for in 00:00…

user1745447
- 37
- 3
- 9
0
votes
2 answers
DateDiff Calculation Issue - Months
Please can anyone shed any light on this for me, and possibly suggest a solution.
I am creating a custom calendar which will be used to schedule events.
In the constructor I pass in 2 dates (startDate and endDate)
The form has a FlowLayoutPanel…

Richard Gale
- 1,816
- 5
- 28
- 45
0
votes
0 answers
Select count datediff in SQL Server
I'm having issues getting the desired results from my database. The join_service_date and dropped_service_date columns have dates. The rejects have an r in the column if it is rejected.
I want to be able to count the agents sales, rejects, dropped…

user1660858
- 23
- 3
0
votes
1 answer
Calculating difference in days between dates with vectors
Based on the post Calculating difference in days between dates
How do I feed the vectors vE and vS with random dates and then return the difference between your dates? Recalling that vS must be greater than vE? Actually, I should separate into two…

Regis Santos
- 3,469
- 8
- 43
- 65
0
votes
1 answer
How to use MDX to calculate the difference between dates on seperate rows?
I am quite new to MDX and I need to write a query that gives me the day difference between two dates. The problem is that the dates exist on two different rows in my data. For example:
My Fact table:
SEAL | STARTDATE | PROCESS | FK_DATE_KEY
1 |…
0
votes
3 answers
java threading issue, right approach?
I am creating a java service which will continuously run in the background and the job of the service is to create a copy of the table at a particular date. To be exact, i read data from some table and if record_date in table matches the current…

wazzz
- 319
- 2
- 4
- 13
0
votes
2 answers
DateDiff in SQL ODBC
I'm using a datediff in SQL. It returns records when run directly in sql server 2008, but when I try and run it through ODBC it doesn't bring up an error, but it returns no rows.
SELECT mc_id, mc_date_entered,
COUNT([mv_value]) total
FROM…

pluke
- 3,832
- 5
- 45
- 68
0
votes
1 answer
Date difference calculation mistake in Javascript
I use the following script to calculate date difference between two dates(with time). It works fine for most of the inputs but the problem is it returns wrong output for some inputs. What is wrong with this code
for example when I calculate date…

arjuncc
- 3,227
- 5
- 42
- 77
0
votes
1 answer
t-SQL and DATEDIFF efficiency vs. precision
I have an SQL Server 2008 table that can be illustrated as such:
CREATE TABLE tbl (dtIn DATETIME2, dtOut DATETIME2)
INSERT tbl VALUES
('9/12/2012 3:21:22 AM', '9/12/2012 3:32:15 AM'),
('9/12/2012 3:58:52 AM', '9/12/2012 4:00:47 AM'),
('9/12/2012…

c00000fd
- 20,994
- 29
- 177
- 400