java时区转换getrawo_java对世界各个时区(TimeZone)的通用转换处理方法(国外英文资料).doc...

java对世界各个时区(TimeZone)的通用转换处理方法(国外英文资料)

java对世界各个时区(TimeZone)的通用转换处理方法

Java has a general conversion approach to the world's time zone (TimeZone).

In the process of developing international software projects, there are sometimes more specific requirements. For example: for example, you do is a shopping site (assuming the server in Shanghai, China), when customers shopping on your web site order up and down all over the world, often want to see the customer location order of time, say I'm a New York man, I in your web site and single, you give me to see a Shanghai order time, will feel very strange. As is known to all, New York time relative to Shanghai is about 13 hours later, if let the customer see the local time zone time, will be more in line with the customer's concept of time, make customer understand more convenient.

In fact, has long been considered the world's time zones in Java (TimeZone) this problem, and presents a more reasonable solution, can be convenient to carry on the conversion of the world's time zones, will a time zones into another time zone. Take a look at the actual example below (the main () method running the example).

In terms of how you know your customer's time zone, you can calculate your time zone based on the client's IP or the country that the user registers.

Java code 01. / *

* Created on 2005-6-10

03. * the Author Stephen

* Email zhoujianqiang AT gmail DOT com

* CopyRight (C) 2005-2008, All rights reserved.

6. * /

7. Package com. Soft4j. The utility;

The euro.

09. Import Java. Text. A ParseException;

10. The import of Java. Text. SimpleDateFormat;

11. The import of Java. Util. Date;

12. The import of Java. Util. GregorianCalendar;

13. The import of Java. Util. TimeZone.

14. The import of Java. Util. Vector;

15.

16.

17.

/ * * 18.

* some common tools that are related to date and time.

* < p >

The common format for the date (time) is: < br >

* yyyy-mm-dd: MM: ss < br >

23. *

* @author Stephen

* @version 1.0.0

26. * /

Public final class DateTool {

28.

/ * * *

The date (time)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值