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

📄 dateutilitiestest.java

📁 java 与COM组件的连接桥
💻 JAVA
字号:
package com.jacob.com;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import com.jacob.com.DateUtilities;

/**
 * test cases that should exercise the new date conversion code
 * <p>
 * May need to run with some command line options (including from inside Eclipse).  
 * Look in the docs area at the Jacob usage document for command line options.
 */

public class DateUtilitiesTest {

    public static void main(String[] args) 
    {
    	Date now = new Date();
    	double comTimeForNow = DateUtilities.convertDateToWindowsTime(now);
    	Date retrievedNow = DateUtilities.convertWindowsTimeToDate(comTimeForNow);
    	if (!now.equals(retrievedNow)){
    		System.out.println("DateUtilities Date Test failed " +now+ " != " +retrievedNow );
    	} else {
    		System.out.println("DateUtilities Date Test passed");
    	}
    	
    	// this is a magic time in the windows world
    	Date beginningOfWindowsTime = 
    		new GregorianCalendar(1899, Calendar.DECEMBER, 30).getTime();
    	double comTimeForBeginningOfWindowsTime = 
    		DateUtilities.convertDateToWindowsTime(beginningOfWindowsTime);
    	if (comTimeForBeginningOfWindowsTime > 0){
    		System.out.println("Beginning of windows time test failed "
    					+comTimeForBeginningOfWindowsTime);
    	} else {
    		System.out.println("Beginning of windows time test passed");
    	}
    	
    }
    

}

⌨️ 快捷键说明

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