1. public class test {
2.
3. public static void main(String[] args) {
4. long ms = 300000;
5. SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
6. formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
7. String hms = formatter.format(ms);
8. System.out.println(hms);
9. }
10.
11. }
本文通过一个Java示例程序展示了如何使用SimpleDateFormat类来格式化毫秒数为指定的时间格式字符串,并设置时区为格林威治标准时间。
1245

被折叠的 条评论
为什么被折叠?



