#NEWLINE# def date_extract_sql( self , lookup_type , field_name ) : #NEWLINE# #INDENT# "\n        Given a lookup_type of 'year', 'month', 'day' or 'week_day', returns\n        the SQL that extracts a value from the given date field field_name.\n        " #NEWLINE# if ( lookup_type == 'week_day' ) : #NEWLINE# #INDENT# return ( 'DATEPART(dw, %s)' % field_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( 'DATEPART(%s, %s)' % ( lookup_type , field_name ) )