首页 > 其他 > 详细

日期月和日补零

时间:2015-01-26 16:58:29      阅读:193      评论:0      收藏:0      [点我收藏+]
/** 
	  * 将元数据前补零,补后的总长度为指定的长度,以字符串的形式返回 
	  * @param sourceDate 
	  * @param formatLength 
	  * @return 重组后的数据 
	  */  
	 public  String frontCompWithZore(int sourceDate,int formatLength)  
	 {  
	  /* 
	   * 0 指前面补充零 
	   * formatLength 字符总长度为 formatLength 
	   * d 代表为正数。 
	   */  
	  String newString = String.format("%0"+formatLength+"d", sourceDate);  
	  return  newString;  
	 }

  

日期月和日补零

原文:http://www.cnblogs.com/xiaoli3007/p/4250586.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!