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
Bad result from DATEDIFF
i have table, where i have column TIME_SEND (time(7)). Int this table i have value 09:50:00.
This is my code:
select DATEDIFF(mi,GETDATE(),(select TIME_SEND from FASTREPORT_SEND))
I want to give difference between actual time (in minutes) and time…

Kate
- 372
- 2
- 11
- 24
0
votes
1 answer
Excel Subtract months from specified date?
How will i subtract months from specified date using datediff function?
for example:
17/10/2013 -(3 months) = 17/07/2013?

user2057099
- 41
- 2
- 3
- 12
0
votes
1 answer
TSQL: Standard deviation of days between transactions
I need to use TSQL to calculate the standard deviation of the number of days between transactions by customer. The table has two columns, CustomerId and TranDate. Each customer has at least 3 unique transaction dates. For example, customer abc may…

Geoffrey
- 196
- 1
- 12
0
votes
1 answer
Summing "masked" datetime ranges using overlapping datetimes in SQL Server
I'm having trouble summing up date differences (in minutes) across overlapping date times, using the second set of datetimes as more of a "mask".
WHAT I HAVE
My table might look something like this:
ID StartDateTime EndDateTime …

Greg Maslin
- 55
- 1
- 6
0
votes
3 answers
Need to modify PHP code for date countdown (want to show nothing when count reaches 0)
Need to modify PHP code for date countdown (want to show nothing when count reaches 0)
I'm using the following code to show a text visual countdown to a specific date, broken down into months, weeks, days. Works great. However, when the countdown…

user2398188
- 1,417
- 3
- 12
- 12
0
votes
2 answers
Asp.Net and Sql Server Time difference in days, hours, minutes
I am working on a issue tracking application with asp.net and sql server 2005. While tracking the issues I am storing the deadline as datetime in the database and also if someone posts a message in the message board the posting date/time is also…

Kunal
- 1,440
- 4
- 14
- 37
0
votes
2 answers
Calculate average from dates in text
I'm using this formulas:
=DATEDIF(B9,S9,"d") & " Days " & TEXT(S9-B9, "h:m") & " hrs:min"
=DATEDIF(B10,S10,"d") & " Days " & TEXT(S10-B10, "h:m") & " hrs:min"
etc..
And now i need to have a formula that calculates the average of those dates. The…

Slider105
- 45
- 1
- 2
- 8
0
votes
1 answer
Loosing the battle - Datediff working but I want to apply a condition
I know I'm gonna 'kick myself' when I see the answer but right now I can't see it.
SELECT [faxdate]
,DATEDIFF(day,
CAST(SUBSTRING(RPT.FaxDate, 1, 4) + '-' + SUBSTRING(RPT.FaxDate, 5, 2) + '-' + SUBSTRING(RPT.FaxDate, 7, 2) AS DATE), getdate()) AS…

Lupii
- 1
- 1
0
votes
1 answer
mysql How to get count of a query's resultant rows with conditions on column returned by datediff
The query that I used (on the right of the link) has generated this result (on left).
Please see http://www.sqlfiddle.com/#!2/f34f1/1
I am new to JasperReports and MySql.
I am trying to
count not yet Referred suspects/confirmed clients
count of…
0
votes
2 answers
Error: Every derived table must have its own alias
UPDATE `FlightSchedule`
SET delay=(
SELECT *
FROM (
SELECT
MINUTE(ETA - STA)
FROM `FlightSchedule`
WHERE `flightNum_arr` = '3517'
)
)
WHERE `flightNum_arr` = '3517';
Says:
"Every derived table must have its own…

Klausos Klausos
- 15,308
- 51
- 135
- 217
0
votes
1 answer
Recursive SUM using DATEDIFF with record VALUE UPDATE
I am working on implementing a points tracking system for monitoring performance. The employee's objective is to have as few as points as necessary. There is a points system in place that allows an employee to reduce their points by performing…

TSoulDreams
- 21
- 1
- 6
0
votes
0 answers
MySQL Using DATEDIFF(MAX(date)... in SELECT
I can't work out how to do this in MySQL:
I have tables transactions and clients.
I want to group the sales for each clients first month into ClientMonth 0, 1, 2 so I can look at how sales tend to change over time for all clients as a group…

user2704416
- 1
- 2
0
votes
2 answers
javascript Date Object how long ago
I'm trying to show how long ago a video was uploaded, i cant seem to get the hours and minutes Date Object Methods to work in this script. I'm working of a script called YouMax 2.0 and i have been editing the function getDateDiff, i have come up…

user2690217
- 31
- 1
- 7
0
votes
3 answers
Calculating differences in time from multiple rows
EquipmentUseId CollectionPointId EmployeeNum ShopOrder StartDateTime
366 69 9999 999999 4/26/13 3:29 PM
373 69 4878 107321 4/26/13 10:19 PM
385 69 …

ctmcklowe96
- 97
- 3
- 11
0
votes
1 answer
Alter table for a datediff (MySQL)
I am trying to alter a table to change one of my column values to datediff() but I keep getting an error and I don't see where my issue is. Here is my code
alter table bids
modify column 'timeLeft' datediff(curdate(),'dueDate');

user2635024
- 37
- 4