java显示当前美国洛杉矶时间
程序员文章站
2024-02-25 20:52:42
复制代码 代码如下:simpledateformat sdf = new simpledateformat("yyyy/mm/dd hh:mm:ss");calendar...
复制代码 代码如下:
simpledateformat sdf = new simpledateformat("yyyy/mm/dd hh:mm:ss");
calendar calendar = calendar.getinstance();
sdf.settimezone(timezone.gettimezone("america/los_angeles"));
system.out.println("los_angeles :"+sdf.format(calendar.gettime()));
sdf.settimezone(timezone.gettimezone("asia/shanghai"));
system.out.println("shanghai: "+sdf.format(calendar.gettime()));
上一篇: java图片验证码实现示例分享