⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dateoper.java

📁 vb+java实现的图书管理系统
💻 JAVA
字号:
package com.bean.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateOper {
    public int nDaysBetweenTwoDate(String firstString, String secondString) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		Date firstDate = null;
		Date secondDate = null;
		try {
			firstDate = df.parse(firstString);
			secondDate = df.parse(secondString);
		} catch (Exception e) {
			// 日期型字符串格式错误
		}
		int nDay = (int) ((secondDate.getTime() - firstDate.getTime()) / (24 * 60 * 60 * 1000));
		return nDay;
	} 
    
//    public static void main(String []arg){
//    	DateOper date=new DateOper();
//    	String firstString="2008-10-10";
//    	String secondString="2008-10-9";
//    	int days=date.nDaysBetweenTwoDate(firstString, secondString);
//    	System.out.println(days);
//    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -