短视频平台源码,平台显示时间,时间格式的转换

短视频平台源码,平台显示时间,时间格式的转换实现的相关代码

 private final static String ERROR_TIME = "1970-01-01 00:00:00";
    private final static String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    private final static SimpleDateFormat fmt = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
    //时间日期格式的转化
    public static String parseTimeStamp(Long time){
        //1. 创建指定时间戳值的日类对象
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(time);
        //2. 转换为日期格式
        Date date = calendar.getTime();
        //3. 转换
        String format = fmt.format(date);
        return format;
    }

​以上就是短视频平台源码,平台显示时间,时间格式的转换实现的相关代码, 更多内容欢迎关注之后的文章

 

posted @ 2021-12-17 14:10  云豹科技-苏凌霄  阅读(48)  评论(0编辑  收藏  举报