I'm using $dayOfMonth
in an aggregation, however this is using the UTC date as it's stored mongo and giving different results as it should be in ETC (-0500). Is there an alternative way to get the day of the month in an aggregation that would allow to use the desired timezone?
Asked
Active
Viewed 63 times
1

dzm
- 22,844
- 47
- 146
- 226
-
2This could possibly help: [here](http://stackoverflow.com/questions/18852095/how-to-agregate-by-year-month-day-on-a-different-timezone) or [here](http://stackoverflow.com/questions/18287493/how-to-deal-with-the-timezone-issue-when-storing-dates-in-utc-using-mongod) – Abdullah Rasheed Nov 12 '15 at 21:21
-
Yes, actually that works. First I had to project the new date that uses add, then use $dayOfMonth against that in another project. – dzm Nov 12 '15 at 21:40
-
cool! glad it worked out. – Abdullah Rasheed Nov 12 '15 at 21:42