Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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.

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

Achivements and leaderboard on ios 0 Answers

Social.localUser username = Lerpz? 2 Answers

GameCenterPlatform.ShowLeaderboardUI not showing correct leaderboard 1 Answer

SOLVED - How can I search and retrieve a single element from a database array? [C#] 3 Answers

Google play leader board player profile not public 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges