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 6540957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:02:40+00:00 2026-05-25T11:02:40+00:00

I am working on an application (using the spring framework) in which current time

  • 0

I am working on an application (using the spring framework) in which current time is stored in the db whenever new records are added.

So when these records are shown to the user in the frontend, the time shown is as per the server’s timezone and not the client’s. As the application targets global audience, it might get confusing to the users if they see a record they just added with a different time.

I am guessing that this problem must be faced by all apps that have users located globally.

What would be the best way to deal with this issue ?

Two options I am considering after doing some searching and reading a few answers on SO are –

1) Getting the user’s timezone using javascript or from the ip adress and storing it in the db instead of the server time.

2) Showing the user, time relative to current time for records recently added (for eg. added 2 mins ago upto added 1 day ago and for earlier records show the actual date.

Not considering the first one as I feel it will result in an inconsistency between the primary key and the created at column in the tables. May not be harmful currently as the users only see their own records but will lead to confusion if each others records are to be shown to them in future.

The second method looks fine to me. In fact, I can see similar stuff on SO (for eg in newest questions relative time is shown and featured questions that are added a few days back show ‘actual’ date and time) but not sure if the same issue is being addressed here.

Would like to know any other approaches.

  • 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-05-25T11:02:41+00:00Added an answer on May 25, 2026 at 11:02 am

    Do #2 as long as you can get away with it. This can be used as long as you have a timestamp associated with each piece of data. If you need to show an actual date (on a calendar for instance), then you must do #1 (or something similar).

    Javascript uses the computers time, so you can always convert server times to local times using Javascript as long as you know the server timezone. If for whatever reason you need to store data in the database in the user’s timezone, always store the timezone along with the time; otherwise it’s meaningless. Perhaps a better option in this case is to store the times in server time and store the user’s timezone somewhere else, then convert times when you need to (as late as possible).

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

Sidebar

Related Questions

I'm working on a real time application implemented using in a SOA-style (read loosely
I am working on profiling a legacy application using Spring AOP and I want
I am working on an application in C# using the .NET Framework 3.5. I
I'm working on a web application written in Java using the Tapestry 5.1.0.5 framework.
Working on a tracking application using GPS. It is all fine, but sometimes because
I am working on a web application using Python (Django) and would like to
I am working on a winforms application using LINQ to SQL - and am
I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display
I'm working in a web application using VB.NET. There is also VisualBasic code mixed
I'm working with an n-Tier application using WinForm and WCF Engine Service (Windows Service)

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.