We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

cfrias on 01/05/08


Tagged


Versions (?)


CalendarGame


Published in: Java 


  1. import java.text.*;
  2. import java.util.*;
  3.  
  4. public class CalendarGame {
  5.  
  6. public static main(String[] args) {
  7.  
  8. Calendar cal = Calendar.getInstance();
  9. DateFormat format = SimpleDateFormat.getDateInstance(DateFormat.LONG);
  10.  
  11. cal.set(Calendar.MONTH, 0);
  12. cal.set(Calendar.DATE, 1);
  13. cal.set(Calendar.YEAR, 1900);
  14.  
  15. Date day = cal.getTime()
  16. System.out.println ("day: " + day);
  17. System.out.println("formatted day: " + format.format(day));
  18.  
  19. cal.add(Calendar.DAY_OF_MONTH, 1400);
  20. day = cal.getTime();
  21. System.out.println("day: " + day);
  22.  
  23. System.out.println("formatted day: " + format.format(day));
  24.  
  25. }
  26.  
  27. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: mugafuga on April 17, 2008

Trash with trash in it! WOW so useful!

You need to login to post a comment.