CalendarTest.java :  » Math » mathmodeling » com » wangqing » iTransportation » Java Open Source

Java Open Source » Math » mathmodeling 
mathmodeling » com » wangqing » iTransportation » CalendarTest.java
package com.wangqing.iTransportation;

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

import org.junit.Test;

public class CalendarTest {
  @Test
  public void testSinglton(){
    Calendar c1 = Calendar.getInstance();
    Calendar c2 = Calendar.getInstance();
    System.out.println(c1 == c2);
    
    System.out.println(c1.getTime());
    System.out.println(c2.getTime());
    c1.set(Calendar.DAY_OF_MONTH, 3);
    c1.set(Calendar.YEAR, 1900);
    c1.set(Calendar.MONTH, 3);
    System.out.println(c1.getTime());
    System.out.println(c2.getTime());
  }
  
  
  @Test
  public void testDate() throws Exception{
    SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
    Date d = sdf.parse("3:15");
    System.out.println(d);
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.