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 ZowPac · Sep 22, 2013 at 07:16 PM · mono.netjni

Most consistent way to handle Timezones (plus JNI help)

So this is possibly a multi-part question. I want award users who log in every day, but base it upon their local timezone. We have a server in C# running in Mono where the award happens, so I want to transmit timezone to the server.

In the .Net world I can get information out of System.TimeZoneInfo.Local (DisplayName seems the smartest thing to use here, but it's referred to as a "Windows format").

I've found that System.TimeZoneInfo isn't available on Android. There's java.util.TimeZone, though I haven't messed with JNI before, and I'm having some big problems getting there - I need to get an object reference through the static class function getDefault(), and then call getID() on that - which is a more Unix-ish format. Getting this to work was my original reason for coming here.

But now I'm wondering if it's worth the effort, is my server in Mono going to be able to decode the Android timezone identifier? Is there a better way of doing this?

My fallback position will be to tease out the offset from UTC, but I'd much rather handle daylight savings transparently (or outlaw it across the globe). I suppose I could have the user input a timezone, but frankly this should not be my job to ask for it. The OS should be able to provide something useful (or perhaps wishful thinking, Unity could translate to some reasonably portable standard).

So what do people think?

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

Answer by ludos · May 14, 2014 at 03:06 PM

Hi, i encountered the same problem (Android not having System.TimeZoneInfo informations at all). Have you found any solution to your problem (specifically how to use java.util.TimeZone)? Any hint or example would be great! Thanks

[edit] i used http://www.codeplex.com/zoneinfo in the end. [/edit]

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
0

Answer by Lancemaker_ · Jul 30, 2015 at 12:32 AM

Im having the same problem. Im using windows all the methods from System.TimezoneInfo are throwing erros. The System.TimeZoneInfo.GetSystemTimezone should be returning tons of timezones, its returning 0. i really dont know how can i keep working on my app without this function. and the only complaint about it is this page. i hope someone can show us some light.

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

18 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

When will Unity Support .NET 4 to the current Mono Level? 1 Answer

`System.IO.File' does not contain a definition for `AppendText'? 1 Answer

Can I use .NET 4 library or Mono 2.8 in Unity ? 2 Answers

What version of Mono the 2017.1 version use? 1 Answer

Can I use Monodevelop bundled with Unity to debug standalone .NET applications? 0 Answers


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