This version will reach end of life on Feb 2018. To upgrade, go to the Learn more about upgrading your version of MongoDB.

Model Time Data

On this page


MongoDB stores times in UTC by default, and will convert any local time representations into this form. 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.


In the MongoDB shell, you can store both the current date and the current client’s offset from UTC.

var now = new Date(); { date: now,
                offset: now.getTimezoneOffset() } );

You can reconstruct the original local time by applying the saved offset:

var record =;
var localNow = new Date( -  ( record.offset * 60000 ) );