将当天时间转换为unix时间戳

/**
     * @return 
     * 
     * @Title: getDate 
     * @Description: TODO(时间戳转换为String类型的日期数据) 
     * @param @param unixDate    设定文件 
     * @return void    返回类型 
     * @throws
     */
    public static String getDate(String unixDate) {
        String re_StrTime = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 例如:cc_time=1291778220
        long lcc_time = Long.valueOf(unixDate);
        re_StrTime = sdf.format(new Date(lcc_time * 1000L));
        return re_StrTime;
    }
    /**
     * 
     * @Title: getCurrentTimestamp 
     * @Description: TODO(当前时间时间戳) 
     * @param @return    设定文件 
     * @return String    返回类型 
     * @throws
     */
    public static String getCurrentTimestamp(){
        String time = System.currentTimeMillis()+"";
        return getDate(time.substring(0, 10));
    }

 

posted @ 2014-01-04 14:00  西北野狼  阅读(227)  评论(0编辑  收藏  举报