[DOCS-7995] Comment on: "manual/reference/operator/aggregation/dateToString.txt" Created: 31/May/16  Updated: 03/Nov/17  Resolved: 09/Jun/16

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Ravind Kumar (Inactive)
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.com/manual/reference/operator/aggregation/dateToString/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36
Referrer: https://docs.mongodb.com/manual/reference/operator/aggregation-date/
Screen Resolution: 1920 x 1080


Participants:
Days since reply: 7 years, 37 weeks ago

 Description   

I am in China
use
'stime'=>array('$first'=>array('$dateToString'=>array('format'=>'%Y-%m-%d %H:%M:%S','date'=>'$eventtime'))),
Time difference of 8 hours
No other function to date,



 Comments   
Comment by Ravind Kumar (Inactive) [ 01/Jun/16 ]

Hello,

The ISODate and Date BSON objects are both based in UTC time, rather than a specific timezone. $dateToString would then show the %H to be 8 hours behind local time in China. You might consider manipulating the result of %H after the document is retrieved in order to correct the time difference.

Generated at Thu Feb 08 07:55:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.