sql select between two dates
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date between '2011/02/25' and '2011/02/27'
sql select between two dates
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date between '2011/02/25' and '2011/02/27'
date difference in number of days sql server
DECLARE
@start_dt DATETIME2= '2019-12-31 23:59:59.9999999',
@end_dt DATETIME2= '2020-01-01 00:00:00.0000000';
SELECT
DATEDIFF(year, @start_dt, @end_dt) diff_in_year,
DATEDIFF(quarter, @start_dt, @end_dt) diff_in_quarter,
DATEDIFF(month, @start_dt, @end_dt) diff_in_month,
DATEDIFF(dayofyear, @start_dt, @end_dt) diff_in_dayofyear,
DATEDIFF(day, @start_dt, @end_dt) diff_in_day,
DATEDIFF(week, @start_dt, @end_dt) diff_in_week,
DATEDIFF(hour, @start_dt, @end_dt) diff_in_hour,
DATEDIFF(minute, @start_dt, @end_dt) diff_in_minute,
DATEDIFF(second, @start_dt, @end_dt) diff_in_second,
DATEDIFF(millisecond, @start_dt, @end_dt) diff_in_millisecond;
find difference in dates sql
SELECT DATEDIFF(day, date1,date2) AS DateDiff
/*
DATEDIFF accepts three arguments
1- day, month, year etc what form you need difference
2,3- dates
*/
sql get number of days between two dates
DATEDIFF(DAY, '1/1/2011', '3/1/2011')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us