@@ -154,13 +154,43 @@ if (!connection.isConnected()) {
154154}
155155` ` `
156156
157+ ### Dates
158+ For DATE and TIMESTAMP types, the driver uses the UTC methods from the Javascript Date object. This means the DATE
159+ value stored will match the value of ` new Date ().toISOString ()` on your client machine. Consider this example
160+ for a client machine in "GMT-0700":
157161
158- # Limitations
162+ Table schema:
159163
160- * Currently no support for column type "Timestamp With Timezone" (Issue #67)
161- * Currently no native support for connection pooling (forthcoming; use generic-pool for now.)
162- * Use getUTC... javascript functions when dealing with dates (See Github discussion on 44b872f)
164+ ` ` ` sql
165+ CREATE TABLE date_test (mydate DATE )
166+ ` ` `
167+
168+ Javascript code:
163169
170+ ` ` ` javascript
171+ ...
172+ var date = new Date (2013 , 11 , 24 , 18 , 0 , 1 ); // Client timezone dependent
173+ console .log (date .toString ()); // Tue Dec 24 2013 18:00:01 GMT-0700 (MST)
174+ console .log (date .toISOString ()); // 2013-12-25T01:00:01.000Z
175+
176+ connection .execute (
177+ " INSERT INTO date_test (mydate) VALUES (:1) " +
178+ " RETURNING mydate, to_char(mydate, 'YYYY-MM-DD HH24:MI:SS') INTO :2, :3" ,
179+ [date, new oracle.OutParam (oracle .OCCIDATE ), new oracle.OutParam (oracle .OCCISTRING )],
180+ function (err , results ) {
181+ console .log (results .returnParam .toString ()); // Tue Dec 24 2013 18:00:01 GMT-0700 (MST)
182+ console .log (results .returnParam1 ); // 2013-12-25 01:00:01
183+ }
184+ );
185+ ...
186+ ` ` `
187+
188+ # Limitations/Caveats
189+
190+ * Currently no native support for connection pooling (forthcoming; use generic-pool for now.)
191+ * Currently no support for column type "Timestamp With Timezone" (Issue #67)
192+ * While the Oracle TIMESTAMP type provides fractional seconds up to 9 digits (nanoseconds), this will be rounded
193+ to the nearest millisecond when converted to a Javascript date (a _data loss_).
164194
165195# Development
166196* Clone the source repo
0 commit comments