// 抓取北京时间
URL url = new URL("https://time.tianqi.com");
// 连接到我们需要抓取时间的网址
URLConnection uc = url.openConnection();
uc.connect();
// 抓取北京时间,获取到的时间为long类型
long time = uc.getDate();
获取网络时间
最新推荐文章于 2024-08-04 11:07:52 发布