We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e70d2c commit 8738f62Copy full SHA for 8738f62
sql_server/pyodbc/operations.py
@@ -126,7 +126,7 @@ def date_interval_sql(self, timedelta):
126
def date_trunc_sql(self, lookup_type, field_name):
127
CONVERT_YEAR = 'CONVERT(varchar, DATEPART(year, %s))' % field_name
128
CONVERT_QUARTER = 'CONVERT(varchar, 1+((DATEPART(quarter, %s)-1)*3))' % field_name
129
- CONVERT_MONTH = 'CONVERT(varchar, 1+((DATEPART(quarter, %s)-1)*3))' % field_name
+ CONVERT_MONTH = 'CONVERT(varchar, DATEPART(month, %s))' % field_name
130
131
if lookup_type == 'year':
132
return "CONVERT(datetime2, %s + '/01/01')" % CONVERT_YEAR
0 commit comments