[DOCS-9094] Comment on: "manual/reference/operator/aggregation/dateToString.txt" Created: 06/Oct/16  Updated: 03/Nov/17  Resolved: 06/Oct/16

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

Type: Bug Priority: Major - P3
Reporter: Wen Chen Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongo shell

Location: https://docs.mongodb.com/v3.0/reference/operator/aggregation/dateToString/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Referrer: https://docs.mongodb.com/v3.0/reference/operator/aggregation-date/
Screen Resolution: 1920 x 1080


Participants:
Days since reply: 7 years, 18 weeks, 6 days ago

 Description   

$dateToString cannot get local date string.
Execute:
db.users.aggregate(
{$match: {createdAt: {$type: 'date'}}},
{$project: {_id: 0, createdAt: 1, day: {$dateToString: {format: '%Y-%m-%d', date: '$createdAt'}}}}
)
One of the results:

{ "createdAt" : ISODate("2016-03-11T00:05:18.816+08:00"), "day" : "2016-03-10" }

But I expected the "day" field could be "2016-03-11". In other words, I want to format the "createdAt" field with timezone.
Would you like to add an operator such as "$timezone"?

*



 Comments   
Comment by Ravind Kumar (Inactive) [ 06/Oct/16 ]

Thank you for filing a DOCS ticket.

It sounds like the functionality you are looking for is described in SERVER-6310. Please consider voting for that topic and providing your use case within that ticket.

The DOCS project is for issues related to the MongoDB Documentation only, and we cannot provide support for feature requests.

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