Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8815631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:25:39+00:00 2026-06-14T04:25:39+00:00

My reason for doing so is that dates stored as date objects in whatever

  • 0

My reason for doing so is that dates stored as date objects in whatever database tend to be written in a specific format, which may greatly differ from what you need to present to the user on the front-end. I also think it’s especially helpful if your application is pulling info from different types of data stores. A good example would be the difference between a MongoDB and SQL date object.

However, I don’t know whether this is recommended practice. Should I keep storing dates as longs (time in milliseconds) or as date objects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:25:40+00:00Added an answer on June 14, 2026 at 4:25 am

    I can’t speak for it in relation to MongoDB, but in SQL database, no, it’s not best practice. That doesn’t mean there might not be the occasional use case, but “best practice,” no.

    Store them as dates, retrieve them as dates. Your best bet is to set up your database to store them as UTC (loosely, “GMT”) so that the data is portable and you can use different local times as appropriate (for instance, if the database is used by geographically diverse users), and handle any conversions from UTC to local time in the application layer (e.g., via Calendar or a third-party date library).

    Storing dates as numbers means your database is hard to report against, run ad-hoc queries against, etc. I made that mistake once, it’s not one I’ll repeat without a really good reason. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some javascript which parses an ISO-8601 date. For some reason, it is
I am getting some data from database that has date break up in year
REASON: I'm working on an emergency alert application that needs to display information on
The reason I ask is, I have a web application written in Ruby (1.8.7-p357)
The reason I am asking is that I am thinking of building a foot
The reason? Pure nostalgia. Anyway, there was a standard for Basic that was published
The reason I'm asking this is because there is a validation in OpenERP that
Unless I use the .toLocaleDateString() method, the function below returns a date that is
Is there a way to get the date/time that a service last started in
There's a rule that says Only mock objects that you own. I think I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.