短视频源代码简单获取时间戳的方式

/**
 * 获取时间戳
 * @param
 * @return
 */
public static int getSecondTimestamp(){
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// HH:mm:ss
    //获取当前时间
    Date date = new Date(System.currentTimeMillis());
    String timestamp = String.valueOf(date.getTime());
    int length = timestamp.length();
    if (length > 3) {
        return Integer.valueOf(timestamp.substring(0,length-3));
    } else {
        return 0;
    }
}
发布了150 篇原创文章 · 获赞 65 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/yb1314111/article/details/105268364