Kentico Smart Search filter query by month name

;with CteMonths(n, m) AS(
    SELECT 1, 'January' UNION ALL
    SELECT 2, 'February' UNION ALL
    SELECT 3, 'March' UNION ALL
    SELECT 4, 'April' UNION ALL
    SELECT 5, 'May' UNION ALL
    SELECT 6, 'June' UNION ALL
    SELECT 7, 'July' UNION ALL
    SELECT 8, 'August' UNION ALL
    SELECT 9, 'September' UNION ALL
    SELECT 10, 'October' UNION ALL
    SELECT 11, 'November' UNION ALL
    SELECT 12, 'December'
)
SELECT
 '+StartDate' AS StartDate,
 '[' + REPLACE(REPLACE(REPLACE(convert(varchar(250), DATEADD(MONTH, n - 1, DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE()), 0)), 120),'-',''),':',''),' ','') + ' TO ' + REPLACE(REPLACE(REPLACE(convert(varchar(250), DATEADD(DAY, -1, DATEADD(MONTH, n, DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE()), 0))), 120),'-',''),':',''),' ','') + ']',
    m
FROM CteMonths

Comments

Popular posts from this blog

HTML5 video loop src change on end play function

Set limit wp_nav_menu

Calculate percentage of a specific element has been scrolled into visible on the screen