Java 时间范围 Util
import java.util.Date;
public class TimeSpan
{
public final static TimeSpan ZERO = new TimeSpan(0);
private long _totalMilliSeconds = 0;
public TimeSpan(long totalMilliSeconds)
{
_totalMilliSeconds = totalMilliSeconds;
}
public TimeSpan(Date afterDate, Date beforeDate)
{
this(afterDate.getTime() - beforeDate.getTime());
}
public long getMilliSeconds()
{
return _totalMilliSeconds;
}
public long getSeconds()
{
return Math.round(_totalMilliSeconds/1000);
}
public long getMinutes()
{
return Math.round(_totalMilliSeconds/(1000*60));
}
public long getHours()
{
return Math.round(_totalMilliSeconds/(1000*60*60));
}
}
相关文档:
// 创建Excel
String destFileName = tableName + ".xls";//文件名
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=".concat(String .valueOf(destFileNa ......
第一节 数据流的基本概念
理解数据流
流一般分为输入流(Input Stream)和输出流(Output Stream)两类,但这种划分并不是绝对的。比如一个文件,当向其中写数据时,它就是一个输出流;当从其中读取数据时,它就是一个输入流。当然,键盘只是一个数人流,而屏幕则只是一个输出流。 ......
安装与设置JDK
Sun JDK的安装基本上有两种方式:
1. 通过Ubuntu提供的包管理工具进行安装
Ubuntu在其包仓库里都包括有JDK的安装,只要sources.list设置正确,通
过apt-get, aptitude, Synaptic Package
Manager等都能安装,而且相关的设置也容易得多;在Ubuntu的新
发布版本里都带了JDK5.0,和JDK6.0的安装支持,而且 ......
public class StringUtil
{
public static String convertToStringWithTrim(Object object)
{
if(null == object)
{
return null;
}
String returnStr = (String)object;
return Trim(returnStr);
}
public static String Trim(String str)
{
if(IsEmpty(str))
{
r ......