I have no problems inserting strings of format 'yyyy-mm-dd hh:mm:ss' into a timestamp with time zone field in my PostgreSQL database using the Matlab datainsert
function. However, I can't seem to work out how to include a time zone in the string itself, so Postgres assumes that it has the timezone of my locale.
For example
create table tmp_test (
id serial primary key,
time timestamp with time zone NOT NULL
);
Then, this works:
datainsert(conn, 'tmp_test', {'time'}, {'2016-09-15 03:45:49.326'})
but this doesn't:
>> datainsert(conn, 'tmp_test', {'time'}, {'2016-09-15 03:45:49.326 +00:00'})
Error using database/datainsert (line 301)
Unable to insert element in row 1 column 1, 2016-09-15 03:45:49.326 +00:00. Timestamp format must be yyyy-mm-dd
hh:mm:ss[.fffffffff]