Skip to content

Commit 5066edb

Browse files
authored
docs(en): add example for using timeZoneOffset
1 parent ab4d5d5 commit 5066edb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/en/faq.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
MongoDB [stores times in UTC by default](https://docs.mongodb.com/manual/reference/bson-types/#document-bson-type-date), and will convert any local time representations into this form.
55
Applications that must operate or report on some unmodified local time value may store the time zone alongside the UTC timestamp, and compute the original local time in their application logic.
66

7-
#### Example for reconstructing the original local time by applying the saved offset:
8-
From the MongoDB shell
7+
#### For reconstructing the original local time you will have to apply the saved offset:
8+
> **⚠ Note** <br>
9+
TimeZoneOffSet is saved in seconds.
910

1011
```javascript
1112
var record = db.getCollection("riskScore").findOne()
12-
print(new Date(record.dateTime.getTime() + (record.timeZoneOffset)) )
13+
var localTime = new Date(record.dateTime.getTime() + record.timeZoneOffset)
1314
```

0 commit comments

Comments
 (0)