Hi

Update Collection to Store Dates in IST

 db.collection.find().forEach(doc => {

    var istDate = new Date(doc.createdAt).toLocaleString("en-IN", { timeZone: "Asia/Kolkata" });

    db.collection.updateOne(

        { _id: doc._id },

        { $set: { formattedDate: istDate } }

    );

});


Previous
Next Post »