Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7385 > unrolled thread

SQLDateTime (Package DatabaseLink) with $TimeZone

Started byndrs <andreas.kohlmajer@gmx.de>
First post2011-12-21 11:58 +0000
Last post2011-12-21 11:58 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  SQLDateTime (Package DatabaseLink) with $TimeZone ndrs <andreas.kohlmajer@gmx.de> - 2011-12-21 11:58 +0000

#7385 — SQLDateTime (Package DatabaseLink) with $TimeZone

Fromndrs <andreas.kohlmajer@gmx.de>
Date2011-12-21 11:58 +0000
SubjectSQLDateTime (Package DatabaseLink) with $TimeZone
Message-ID<jcshlp$2aj$1@smc.vnet.net>
Hello!

Is there a simple solution to use $TimeZone together with SQLDateTime
to write to the SQL data type datetimeoffset?

Example: SQL (MS SQL 2008) database [TestDB] with a table [TestData],
having only one column [Timestamp1] declared as datetimeoffset(2).
This stores a timestamp, together with the time zone information and a
precision of max. 2 decimals of a second, e.g. SELECT
CONVERT(DATETIMEOFFSET(2),SYSDATETIMEOFFSET()) gives "2011-12-20
09:40:16.42 +01:00" (current time in Germany).

Reading this column via package DatabaseLink gives SQLDateTime[{2011,
12, 20, 9, 40, 16.42}]. If I write SQLDateTime[{2011, 12, 20, 9, 40,
16.42}] back to the database, I get "2011-12-20 09:40:16.42 +00:00",
so the time zone information is lost - more precisely: it has not been
transmitted, I think. Is there a way to use $TimeZone, that the result
would be "2011-12-20 09:40:16.42 +01:00"?

Thanks for your help!

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web