1 4 package org.roller; 5 6 import java.text.DateFormat ; 7 import java.util.Calendar ; 8 import java.util.Date ; 9 10 import org.roller.business.FileManagerTest; 11 12 import junit.framework.Test; 13 import junit.framework.TestCase; 14 import junit.framework.TestSuite; 15 16 19 public class DateTest extends TestCase 20 { 21 22 public static void main(String [] args) 23 { 24 junit.textui.TestRunner.run(DateTest.class); 25 } 26 27 public void testDate() throws Exception 28 { 29 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); 30 Date newDate = df.parse("5/8/1964"); 31 Calendar cal = Calendar.getInstance(); 32 cal.setTime(newDate); 33 cal.set(Calendar.HOUR_OF_DAY, 11); 34 cal.set(Calendar.MINUTE, 39); 35 cal.set(Calendar.SECOND, 0); 36 System.out.println(cal.getTime().toString()); 37 } 38 39 public static Test suite() 40 { 41 return new TestSuite(DateTest.class); 42 } 43 } 44 | Popular Tags |