<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:47:10 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[DOCS-4086] How to store local time in MongoDB?</title>
                <link>https://jira.mongodb.org/browse/DOCS-4086</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;I&apos;m developing my first commercial project using MongoDB. Otherwise very pleased with the quality of the product and documentation, but the corner of handling local times would seriously need more effort, either in the API and/or a tutorial describing good practices.&lt;/p&gt;

&lt;p&gt;StackOverflow.com has multiple cases where people are equally puzzled by this, it&apos;s not only me. It should be easy and explicit to:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;save UTC date and retrieve one, without conversions to the local time zone&lt;/li&gt;
	&lt;li&gt;save local time and retrieve one, as above&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Our customer case is that we want UTC time stamps for the normal reasons, but also wish to see what &quot;wall clock time&quot; and e.g. day of week the stored data fits, in the local context. A tutorial describing how to do this would have helped.&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;should we store local times as BsonDateTime (as if they were UTC)&lt;/li&gt;
	&lt;li&gt;should we store using &quot;minutes from the beginning of the week&quot; (fine grained time would come from the UTC time stamp)&lt;/li&gt;
	&lt;li&gt;should we do something else?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I think much of the confusion is due to Joda DateTime. I&apos;m considering not using it, later, and dealing with BsonDateTime objects directly. However, for now things are reasonably okay so this must wait.&lt;/p&gt;

&lt;p&gt;Other things being so nice and trivial with MongoDB, how about fixing the local time corner as well?&lt;/p&gt;

&lt;p&gt;Links to StackOverflow issues regarding these:&lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/26023835/how-to-read-back-a-datetime-as-utc-in-mongodb-casbah&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/26023835/how-to-read-back-a-datetime-as-utc-in-mongodb-casbah&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/16901393/storing-utc-and-local-datetime-in-mongo&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/16901393/storing-utc-and-local-datetime-in-mongo&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Casbah driver (Scala) on OS X</environment>
        <key id="160169">DOCS-4086</key>
            <summary>How to store local time in MongoDB?</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="andrew.aldridge@mongodb.com">Andrew Aldridge</assignee>
                                    <reporter username="akauppi">Asko Kauppi</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Sep 2014 12:14:52 +0000</created>
                <updated>Fri, 17 Oct 2014 18:59:00 +0000</updated>
                            <resolved>Fri, 17 Oct 2014 18:58:52 +0000</resolved>
                                                    <fixVersion>v1.3.12</fixVersion>
                                    <component>manual</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="744474" author="xgen-internal-githook" created="Fri, 17 Oct 2014 18:58:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;i80and&apos;, u&apos;name&apos;: u&apos;Andrew Aldridge&apos;, u&apos;email&apos;: u&apos;i80and@foxquill.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-4086&quot; title=&quot;How to store local time in MongoDB?&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-4086&quot;&gt;&lt;del&gt;DOCS-4086&lt;/del&gt;&lt;/a&gt;: Guide to handling localtime&lt;/p&gt;

&lt;p&gt;Signed-off-by: kay &amp;lt;kay.kim@10gen.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/6956cf16b087b34932dc943f49e29b0aa5fb05f2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/6956cf16b087b34932dc943f49e29b0aa5fb05f2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="726895" author="akauppi" created="Thu, 25 Sep 2014 12:42:42 +0000"  >&lt;p&gt;A third SO entry: &lt;a href=&quot;http://stackoverflow.com/questions/12830521/how-to-translate-utc-time-to-arbitrary-local-time-in-mongo-j-s&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/12830521/how-to-translate-utc-time-to-arbitrary-local-time-in-mongo-j-s&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="726894" author="akauppi" created="Thu, 25 Sep 2014 12:40:42 +0000"  >&lt;p&gt;Ideally, the MongoDB API could allow storing &quot;local time&quot;, maintaining the time zone information as well. If I store local time &quot;as UTC&quot;, I will wipe out the time zone info.&lt;/p&gt;

&lt;p&gt;But most importantly, conversions between local and UTC (and the particular machine&apos;s local time zone, which may be yet something else) should not happen as implicitly as they now seem to happen. Any such conversions should be explicit, by the Scala compiler.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="159945">DOCS-4082</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10855" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Actual Time</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>16.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 15 Oct 2014 18:14:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 17 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>jess.mokrzecki@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 17 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.aldridge@mongodb.com</customfieldvalue>
            <customfieldvalue>akauppi</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrqsgv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs2j1b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>139490</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hryqpr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                </customfields>
    </item>
</channel>
</rss>