gpt4 book ai didi

java - TimeZone.getDefault() 是如何工作的?

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:46:53 28 4
gpt4 key购买 nike

My server is in US and I am accessing the application in India through web browser, in that case what TimeZone.getDefault() will return? If it returns Time Zone based on India on basis of what it will return?

I have changed in control panel setting to different locale and different time zone of the system even though it is not changing based on my settings.

I have written the code as fallows...

def dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,DateFormat.DEFAULT,Locale.getDefault())
dateFormat.setTimeZone(TimeZone.getDefault())

最佳答案

它将返回执行 JVM TimeZone.getDefault() 的时区。因此,如果应用程序在印度的服务器上运行,它将类似于“Asia/Calcutta”。

关于java - TimeZone.getDefault() 是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14895739/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com