• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by crazy_boy_02 · Mar 01, 2013 at 11:15 AM · leaderboardtimespan

Leader board which maintains different time zones ?

HI All,

Firstly i know that the question which i am going to post is not confined only to unity, but the reason of posting it here is that it could get direct response from the game dev world.

I am creating a dice based game which consist of a leader board system where we have separate table for top 20 entries in a day,month,year and all time.

Now the issues which i am facing is related to Time Zone,Suppose i am playing in USA and it's currently tuesday at my place but at the same time a user is playing in some asian country which is around 10 hours ahead of me and he is currently in wednesday. Then on which table should i store the scores to wednesday or tuesday.

and when user wants to see the top users of the day, which day scores will he see in his respective time zone.

Firstly i thought of taking a standart time but it didn't seem to be the right approach to me.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Graham-Dunnett · Mar 01, 2013 at 12:28 PM

Think of it this way. Rather than having top 20 entries in a day, have a table that shows the top 20 entries in the last 24 hours. Convert all the dates from the players local time zone into UTC and store those in the database. If you show the times to the user, then convert them from UTC into the local timezone.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Tarlius · Mar 01, 2013 at 12:39 PM

You will be best off storing all times in UTC (universal standard time) and localising them from there. Storing times in UTC is pretty standard.

You will probably want to use the DataTime class for this. In particular, take a look at DateTime.ToLocalTime, DateTime.ToUniversalTime, and DateTime.Now.

Also: Make sure you use constant locale when getting string values of your dates. 2013/3/21 is a valid (and correct) date in Japan, 21/3/2013 in UK(/Europe?) and 3/21/2013 in America. Note that I chose dates that can't be confused, but consider 12/11/10!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

(Unity iPhone) Help With Online Leaderboard Using Facebook Connect 2 Answers

Web Player build leaderboard returns blank data when integrated the game in Facebook page. 0 Answers

Getting playerID from the Google Play Leaderboard? 0 Answers

Google Play Services Unity Plugin not Show Leaderboard 1 Answer

Local Leaderboard with unique names 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges