码迷,mamicode.com
首页 > 其他好文 > 详细

时间戳 时分秒

时间:2015-08-25 13:43:56      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:

public static StringBuffer change(int second){  
        int h = 0;  
        int d = 0;  
        int s = 0;  
        int temp = second%3600;  
             if(second>3600){  
               h= second/3600;  
                    if(temp!=0){  
               if(temp>60){  
               d = temp/60;  
            if(temp%60!=0){  
               s = temp%60;  
            }  
            }else{  
               s = temp;  
            }  
           }  
          }else{  
              d = second/60;  
           if(second%60!=0){  
              s = second%60;  
           }  
          }  
             
             StringBuffer str = new StringBuffer();
             str.append("完成充电剩余:");
             if(h!=0){
                 str.append(h+"小时");
             }
             if(d!=0){
                 str.append(d+"分钟");
             }
//             if(s!=0){
//                 str.append(s+"秒");
//             }


         return str;  
       }

 

时间戳 时分秒

标签:

原文地址:http://www.cnblogs.com/yaoyao66123/p/4756913.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!