Reputation: 79
i am working on an application where i have some Promotion which has a startdate and endate.Now whenever a user applies a valid promotion code while doing a trade , the promotion shall be applied if current date is betwwen the startdate and enddate.The issue occurs for different Timezones.For e.g the logged in user has a separate Timezone then the server situations arise when the promotion date is valid as per user's timezone but the same has expired as per the Time zone on Server,so the promotion is not applied.I am using Hibernate detached criteria, is there any way to use Timezone with the same? Any help/suggestions are appreciated.
Upvotes: 0
Views: 327
Reputation: 1485
it is always standard to put dates/timestamps in GMT in server. Your client side should be responsible to convert it to the user locale timezone. And there are plenty of utilities and framework support for this.
Upvotes: 1
Reputation: 3903
Use GMT to store all of your times in the DB. then your timezone is a +- calculation on the base time. This is how you internationalize your datetimes.
Upvotes: 2