KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > DateTest


1 /*
2  * Created on Mar 10, 2004
3  */

4 package org.roller;
5
6 import java.text.DateFormat JavaDoc;
7 import java.util.Calendar JavaDoc;
8 import java.util.Date JavaDoc;
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 /**
17  * @author dmj
18  */

19 public class DateTest extends TestCase
20 {
21
22     public static void main(String JavaDoc[] args)
23     {
24         junit.textui.TestRunner.run(DateTest.class);
25     }
26     
27     public void testDate() throws Exception JavaDoc
28     {
29         DateFormat JavaDoc df = DateFormat.getDateInstance(DateFormat.SHORT);
30         Date JavaDoc newDate = df.parse("5/8/1964");
31         Calendar JavaDoc 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