Demos and Usage of java.text.DateFormat.getTimeInstance()


   1: import java.util.*;
   2: import java.text.DateFormat;
   3: 
   4:         ...
   5:         Date date = cal.getTime();
   6:         DateFormat dateFormatter = DateFormat.getTimeInstance();
   7:         g.drawString(dateFormatter.format(date), 5, 10);
   8:     }
   9:     public void wakeUp() {

View Full Code Here
   1:         Date now = new Date();
   2:         DateFormat formatter = DateFormat.getTimeInstance();
   3:         System.out.println("Default:    "+formatter.format(now));
   4:         ...
   5:         formatter = DateFormat.getTimeInstance(DateFormat.SHORT);
   6:         System.out.println("Short:      "+formatter.format(now));
   7:         ...
   8:         formatter = DateFormat.getTimeInstance(DateFormat.MEDIUM);
   9:         System.out.println("Medium:     "+formatter.format(now));

View Full Code Here
   1: import javax.swing.Timer;
   2: import java.text.DateFormat;
   3: 
   4:         ...
   5:         Date date = cal.getTime();
   6:         DateFormat dateFormatter = DateFormat.getTimeInstance();
   7:         g.drawString(dateFormatter.format(date), 5, 100);
   8:     }

View Full Code Here
   1: import java.io.Serializable;
   2: import java.text.DateFormat;
   3: import java.text.ParseException;
   4:         ...
   5:             try {
   6:                 Date date = DateFormat.getTimeInstance().parse( (String) value );
   7:                 return date.after( new Date() );
   8:             }
   9:             catch (ParseException nfe) {

View Full Code Here
   1: import java.util.*;
   2: import java.text.DateFormat;
   3: 
   4:         ...
   5:         Date date = cal.getTime();
   6:         DateFormat dateFormatter = DateFormat.getTimeInstance();
   7:         g.drawString(dateFormatter.format(date), 5, 10);
   8:     }
   9:     public void stop()

View Full Code Here
   1: import java.io.Serializable;
   2: import java.text.DateFormat;
   3: import java.text.ParseException;
   4:         ...
   5:             try {
   6:                 Date date = DateFormat.getTimeInstance().parse( (String) value );
   7:                 return date.before( new Date() );
   8:             }
   9:             catch (ParseException nfe) {

View Full Code Here
   1:   private String[] availableTimeZones = TimeZone.getAvailableIDs();
   2:   private DateFormat dateFormat = DateFormat.getDateInstance();
   3:         ...
   4:   private DateFormat timeFormat = DateFormat.getTimeInstance();
   5:   private Date date = new Date();
   6:   private JTextField jtfDate = new JTextField(dateFormat.format(date));
   7:   private JTextField jtfTime = new JTextField(timeFormat.format(date));

View Full Code Here
   1: 
   2: import java.text.DateFormat;
   3: import java.util.Calendar;
   4:         ...
   5:         protected String resolve(TemplateContext context) {
   6:             return DateFormat.getDateInstance().format(new java.util.Date());
   7:         }
   8:         ...
   9:         protected String resolve(TemplateContext context) {
  10:             return DateFormat.getTimeInstance().format(new java.util.Date());
  11:         }

View Full Code Here
   1: import java.net.URL;
   2: import java.text.DateFormat;
   3: 
   4:         ...
   5:             {
   6:                 final java.text.DateFormat timeFormatter = new java.text.SimpleDateFormat(timePattern);
   7:                 timeFormatter.parse(value);
   8:         ...
   9:             {
  10:                 DateFormat.getTimeInstance().parse(value);
  11:             }

View Full Code Here
   1: import java.io.*;
   2: import java.text.DateFormat;
   3: import java.util.Date;
   4:         ...
   5:     public static void showDate(PrintStream ps){
   6:         DateFormat df = DateFormat.getDateInstance();
   7:         ...
   8:         DateFormat tf = DateFormat.getTimeInstance();
   9:         Date d = new Date();

View Full Code Here
   1: import java.lang.reflect.Constructor;
   2: import java.text.DateFormat;
   3: import java.text.ParseException;
   4:         ...
   5: {
   6:    private static final DateFormat[] allFormats = new DateFormat[]{
   7:       DateFormat.getDateInstance(),
   8:         ...
   9:       DateFormat.getTimeInstance(),
  10:       DateFormat.getDateTimeInstance(),

View Full Code Here
   1: import java.io.*;
   2: import java.text.DateFormat;
   3: import java.util.*;
   4:         ...
   5:             
   6:             String dateString = DateFormat.getDateInstance().format(date); 
   7:         ...
   8:             String timeString = DateFormat.getTimeInstance().format(date);
   9:             

View Full Code Here
   1: import java.lang.reflect.Constructor;
   2: import java.text.DateFormat;
   3: import java.text.ParseException;
   4:         ...
   5: {
   6:    private static final DateFormat[] allFormats = new DateFormat[]{
   7:       DateFormat.getDateInstance(),
   8:         ...
   9:       DateFormat.getTimeInstance(),
  10:       DateFormat.getDateTimeInstance(),

View Full Code Here
   1: 
   2: import java.text.DateFormat;
   3: import java.util.*;
   4:         ...
   5:     public void writeAccounts(Writer writer) throws IOException{
   6:         DateFormat df = DateFormat.getDateInstance();
   7:         ...
   8:         DateFormat tf = DateFormat.getTimeInstance();
   9:         Date d = new Date();

View Full Code Here
   1: 
   2:     private static java.text.DateFormat[] format;
   3: 
   4:         ...
   5:     static {
   6:         format = new java.text.DateFormat[7];
   7:         format[0] = new java.text.SimpleDateFormat("yyyy");
   8:         ...
   9:         Calendar cal = _AbsoluteTime.getValue();
  10:         java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd");
  11:         java.text.DateFormat timeFormat = new java.text.SimpleDateFormat("HH:mm:ss.SSS");

View Full Code Here