I’m trying to filter my SQL results for a date on a specific year.
The dates are stored in a single column DATE in the format month/day/year
I need to only grab the result for certain years.
String sql = SELECT DATE FROM TABLENAME
WHERE **LAST TWO DATE DIGITS** = ? ORDER BY DATE DESC;
ps.setString(1, yearDesired);
Is this possible? I have been looking around and haven’t found an issue directly related to this.
Thank you for any help.
Several databases support the
YEAR()function:For a more specific answer, post the database you’re using.