Trying to add a zero before the value if it's less than 10
eg:2001-5-9 as 2001-05-09
Look into to_char() for date formatting:
http://www.postgresql.org/docs/current/static/functions-formatting.html
select to_char(foo, 'YYYY-MM-DD')
If it's not a date already, cast it accordingly
select to_char(foo::date, 'YYYY-MM-DD')