@@ -9369,10 +9369,19 @@ are not supported.
9369
9369
Note that JavaScript Date has millisecond precision therefore
9370
9370
timestamps will lose any sub-millisecond fractional part when fetched.
9371
9371
9372
- To make applications more portable, it is recommended to always set
9373
- the session time zone to a pre-determined value, such as UTC. This
9374
- can be done by setting the environment variable [`ORA_SDTZ`][42]
9375
- before starting Node.js, for example:
9372
+ To make applications more portable, it is recommended to always set the session
9373
+ time zone to a pre-determined value, such as UTC. The session timezone should
9374
+ generally match the client system timezone, for example the `TZ` environment
9375
+ variable or the Windows timezone region.
9376
+
9377
+ You can find the current session timezone with:
9378
+
9379
+ ```sql
9380
+ SELECT sessiontimezone FROM DUAL;
9381
+ ```
9382
+
9383
+ You can set the environment variable [`ORA_SDTZ`][42] before starting Node.js,
9384
+ for example:
9376
9385
9377
9386
```
9378
9387
$ export ORA_SDTZ='UTC'
@@ -9413,8 +9422,17 @@ BEGIN
9413
9422
END;
9414
9423
```
9415
9424
9416
- See [Working with Dates Using the Node.js Driver][43] for more
9417
- discussion of date handling.
9425
+ A query that returns the node-oracledb client-side date and timestamp is:
9426
+
9427
+ ```sql
9428
+ oracledb.fetchAsString = [oracledb.DATE];
9429
+ result = await connection.execute(`SELECT current_date, current_timestamp FROM DUAL`);
9430
+ console.log(result);
9431
+ ```
9432
+
9433
+ For more information on time zones, see Oracle Support's [Timestamps & time
9434
+ zones - Frequently Asked Questions, Doc ID 340512.1][165]. Also see [Working
9435
+ with Dates Using the Node.js Driver][43].
9418
9436
9419
9437
##### <a name="fetchasstringhandling"></a> 15.1.6.4 Fetching Numbers and Dates as String
9420
9438
@@ -14543,3 +14561,4 @@ can be asked at [AskTom][158].
14543
14561
[162]: https://www.oracle.com//cloud/free/
14544
14562
[163]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-C672E92D-CE32-4759-9931-92D7960850F7
14545
14563
[164]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=SHARD
14564
+ [165]: https://support.oracle.com/epmos/faces/DocumentDisplay?id=340512.1
0 commit comments