I'm currently looking for a creative way how to find out if the user.timezone in java was altered by command line arguments or some other custom configuration. So technically I'm looking for a solution how to determine the real timezone of a computer (if this is even possible).
Any help is highly appreciated.
Thanks,
The first solution that pops into my mind is probing external sources. eg if you type
wmic timezone get StandardName
in a Windows command line you should get your timezone. Theoretically you could get the output by running this command in Java, as described in this thread .
PS It's probably not 'high-quality' to run an obscure command in Java and it's probably not the most efficient thing either. The idea is to somehow use another process that doesn't inherit JVM arguments or other 'customizations' (eg command line, Javascript, possibly other script languages, etc.)
Another possibility would be (depending on what client info you have available) to use Google's Time Zone API .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.