Questions tagged [datepart]

DATEPART is a T-SQL function that converts a DATE type to INT according to provided format.

datepart(datepart,date_time_value) is a T-SQL function available in MS SQL Server and the SAP/Sybase family of database products.

SQL Server Syntax

SAP/Sybase Syntax

257 questions
-3
votes
1 answer

SQL dates returns 12/20/18 when it should be 12/20/17

Any help would be appreciated. it works for 2/10/18, 3/10/18 but not 4/10/18 This is to get a date range for a report that runs every month on the 10th for all accounts that are 75 day past due and not reported on last month report DECLARE…
-4
votes
2 answers

Sort by DateName doesn't work in SQL

I am trying to calculate the total hours worked by each employee per month. Following is the code which i used: SELECT emp_name, emp_id, monthval = DATENAME( month, Pdate), Total_Time = (CAST(SUM(DATEDIFF(MI, In_Punch,…
Ashish Sah
  • 31
  • 2
  • 12
1 2 3
17
18