sql - PostgreSQL unable to parse string to date using to_date() -
i have pretty standard date string need parse date type:
"2016-06-01t23:34:25+00:00"
i'm using 'yyyy-mm-ddthh24:mi:ss'
format mask , query try , parse date:
select to_date('last_updated_on', 'yyyy-mm-ddthh24:mi:ss') last_updated_on locations limit 1
what happens error:
error: invalid value ":2" "mi" sql state: 22007 detail: value must integer.
i've looked on in documentation , on trying find out why happening, , i'm totally baffled.
i'm using postgresql 9.4
surround t
in format string ""
. if time part of date needs preserved, use to_timestamp()
.
select to_date('last_updated_on', 'yyyy-mm-dd"t"hh24:mi:ss') last_updated_on locations limit 1
converting date timestamp
select to_timestamp('last_updated_on', 'yyyy-mm-dd"t"hh24:mi:ss') last_updated_on locations limit 1