Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Extensions » View Thread |
Messages 1 to 3 of 3 total |
LIB - func - IsCurYear.sql |
Mon, Feb 6 2012 8:58 AM | Permanent Link |
Lucian | CREATE FUNCTION "IsCurYear" (
IN "ADate" DATE) RETURNS BOOLEAN BEGIN DECLARE Result BOOLEAN DEFAULT False; DECLARE EndDate, StartDate DATE; DECLARE iYear INTEGER; SET EndDate = CURRENT_DATE; SET iYear = EXTRACT(YEAR, EndDate); SET StartDate = CAST(CAST(iYear AS VARCHAR) + '-01-01' AS DATE); IF ADate BETWEEN StartDate AND EndDate THEN SET Result = True; ELSE SET Result = False; END IF; RETURN Result; END DESCRIPTION 'Boolean function to return TRUE if the given date belongs to current year.' |
Wed, Feb 8 2012 3:16 AM | Permanent Link |
David Cornelius Cornelius Concepts | This will do the same...
CREATE FUNCTION "IsCurYear" (IN "ADate" DATE) RETURNS BOOLEAN BEGIN RETURN (EXTRACT(YEAR FROM ADate) = EXTRACT(YEAR FROM CURRENT_DATE)); END DESCRIPTION 'Boolean function to return TRUE if the given date belongs to current year.' David Cornelius Cornelius Concepts |
Wed, Feb 8 2012 7:28 AM | Permanent Link |
Lucian | >This will do the same...
I started I think with IsLastWeek or IsLastMonth, than blindly copy-pasted and adjusted it for the other utilities, without realising there's a simpler way Thank you for reviewing it, it's much better when it's simple! Lucian |
This web page was last updated on Wednesday, April 17, 2024 at 10:35 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |