Get the last date a given month


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. CREATE OR REPLACE FUNCTION LastDateOfMonth(DATE) RETURNS DATE AS '
  2. SELECT CAST(date_trunc(''month'', $1) + interval ''1 month''
  3. - interval ''1 day'' as date);
  4. ' LANGUAGE SQL;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.