SQL Server – Diferencia de Fechas
Written by lopezatienza on 24/04/2009 – 11:16 -Para calcular la diferencia entre fechas podemos usar el DateDiff.
DATEDIFF (datepart , startdate , enddate )
En datepart podemos usar:
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms
Ejemplo:
SELECT DATEDIFF(day, ColumnaFecha, getdate()) AS date FROM Facturas
Tags: SQL Server
Posted in SQL Server | No Comments »