// 将时间戳转换成日期格式: function timestampToTime(timestamp) { var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '年'; var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '月'; var D = (dat
日期和时间转换字符 字符 描述 例子 c 完整的日期和时间 Mon May 04 09:51:52 CDT 2009 F ISO 8601 格式日期 2004-02-09 D U.S. 格式日期 (月/日/年) 02/09/2004 T 24小时时间 18:05:19 r 12小时时间 06:05:19 pm R 24小时时间,不包含秒 18:05 Y 4位年份(包含前导0) 2004 y 年份后2位(包含前导0) 04 C 年份前2位(包含前导0) 20 B 月份全称 February b 月
--------------------------------------- --------------------------------------- import java.util.*; public class Main { public static void main(String[] args) { int n = new Scanner(System.in).nextInt(); int i,j,k; i = n/3600; j = (n%3600)/60; k = (n%
获取当前时间戳 // 获取当前的时间戳 long time = new Date().getTime(); 将字符串时间戳转成格式的时间字符串 Long timestrap = Long.parseLong("1534074968019"); Date date = new Date(timestrap); String timeStr = date.toLocaleString(); // 1970-10-3 4:01:14