#DateForumTypeThreadPost
702 Dec 2013 @ 08:20 PSTDatabaseReplyDay Of Week or Week-Ending Function?This works for computing a Friday week ending date: CASE WHEN ((any_date - (000101 (DATE))) + 1) MOD 7 = 6 THEN any_date + 6      ELSE   any_date + (6 - (((any_d...
604 Jan 2012 @ 10:54 PSTDatabaseReplyAge Calculation One additional note:  the formula results in an overflow error for ages over 100, so you have to handle that age range separately.  
504 Jan 2012 @ 10:06 PSTDatabaseReplyAge Calculation This does work to the exact date for specific dates: SELECT (EXTRACT(YEAR FROM DATE '2012-01-04') - EXTRACT(YEAR FROM DATE '1989-01-04') (NAMED YEARS))    &n...
404 Jan 2012 @ 10:06 PSTDatabaseReplyGetting a person's exact age This does work to the exact date for specific dates: SELECT (EXTRACT(YEAR FROM DATE '2012-01-04') - EXTRACT(YEAR FROM DATE '1989-01-04') (NAMED YEARS))    &n...
304 Jan 2012 @ 09:55 PSTUDAReplyDate of birth MMDDYYYY text convert to date format and get age Also you don't have 1/4th of a leap day every year of a person's life.  People under age 4 may have no leap days.  Something to consider.
204 Jan 2012 @ 09:53 PSTDatabaseReplyGetting a person's exact age select ( cast('2012-01-01' as date) - cast('1989-01-04' as date)) year(4) as abc; This similar query returns age 23  three days before the person turns 23, so the YEAR(4...
104 Jan 2012 @ 09:28 PSTDatabaseReplyAge Calculation The formula above does not exactly compute the age to the day, because it assumes there is 1/4th of a extra day for every year of life, but when the person is under 4, there may be no leap years...