grails - Converting date into PostgreSQL format -


i have date time in format: mon jun 11 12:16:14 edt 2013 want inserted in postgres date attribute, postgres inserts current date time. think issue format. normal date format in postgres like: 2012-06-13 04:24:45

how change mon jun 11 12:16:14 edt 2013 format compatible postgres?

thank you!!!

you want to_date or to_timestamp function.

you give string date, , patten how parse date. example be:

select to_timestamp('mon jun 11 12:16:14 edt 2013', 'dy mon dd hh24:mi:ss ??? yyyy');        to_timestamp       ------------------------  2013-06-11 12:16:14+01 

i don't think can't work timezone these functions unfortunately (hence ???)

you should able cast string like:

 'mon jun 11 12:16:14 edt 2013'::timestamptz; 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -