Обсуждение: ISO8601 Time and ODBC

Поиск
Список
Период
Сортировка

ISO8601 Time and ODBC

От
"Carl Shelbourne"
Дата:

I am trying to get a fully qualified ISO8601 string

yyyy-mm-dd hh:mm:ss.h+MM:SS where MM:SS are the time offsets to GMT.

I am Using Postgres 7, UNIXodbc.

Using psql to query the table I get the time as:

2000-08-30 12:00:00+01

But the query via ODBC returns a SQL_C_TYPE_TIMESTAMP struct defined as

SQL_C_TYPE_TIMESTAMP  SQL_TIMESTAMP_STRUCT struct tagTIMESTAMP_STRUCT {    SQLSMALLINT year;    SQLUSMALLINT month;
SQLUSMALLINTday;    SQLUSMALLINT hour;    SQLUSMALLINT minute;    SQLUSMALLINT second;    SQLUINTEGER fraction;
 
} TIMESTAMP_STRUCT;

The problem I have is I am working across timezones and I need to know the time
offset to GMT. Currently I am in the UK on BST +01:00, which psql seems to
return,

Does anybody know how I can get the offset to the time returned by Postgres
using ODBC??, this is not included in the above struct.

Thanks

Carl





Re: ISO8601 Time and ODBC

От
Thomas Lockhart
Дата:
> Does anybody know how I can get the offset to the time returned by Postgres
> using ODBC??, this is not included in the above struct.

select date_part('timezone', timefield)

will do it, so just return another column in the query.
                   - Thomas