Postgresql Function Set Variable In T Sql Convert Date Formats