Example usage for java.text DateFormat getTimeInstance

List of usage examples for java.text DateFormat getTimeInstance

Introduction

In this page you can find the example usage for java.text DateFormat getTimeInstance.

Prototype

public static final DateFormat getTimeInstance() 

Source Link

Document

Gets the time formatter with the default formatting style for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance();

    String s = dateFormat.format(new Date());
    System.out.println(s);//from ww w.  j  a va  2 s  . c  o  m

}

From source file:Main.java

public static void main(String args[]) {
    DateFormat df1 = DateFormat.getDateInstance();
    DateFormat df2 = DateFormat.getTimeInstance();
    System.out.println(df1.equals(df2));
}

From source file:Main.java

public static String getCurrentTime(Date date) {
    String currentDateTimeString = DateFormat.getTimeInstance().format(date);

    return currentDateTimeString;
}

From source file:net.alexjf.tmm.fragments.TimePickerFragment.java

public TimePickerFragment() {
    time = Calendar.getInstance();
    timeFormat = DateFormat.getTimeInstance();
}

From source file:com.haskins.cloudtrailviewer.utils.DateTimeCrosshairLabelGenerator.java

/**
 * Creates a new instance with default attributes.
 */
public DateTimeCrosshairLabelGenerator() {
    this("{0}", DateFormat.getTimeInstance());
}

From source file:org.svij.taskwarriorapp.ui.TimePickerFragment.java

public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Calendar cal = Calendar.getInstance();

    Date date = new Date(timestamp);
    if (!DateFormat.getTimeInstance().format(date).equals("01:00:00")) {
        cal.setTime(date);//from ww  w.  java  2 s.c  om
    }

    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int minute = cal.get(Calendar.MINUTE);

    return new TimePickerDialog(getActivity(), onTimeSet, hour, minute, true);
}

From source file:com.haulmont.chile.core.datatypes.impl.TimeDatatype.java

@Override
public String format(Object value) {
    if (value == null) {
        return "";
    } else {/*from www  .j  a v  a 2s  .com*/
        DateFormat format;
        if (formatPattern != null) {
            format = new SimpleDateFormat(formatPattern);
        } else {
            format = DateFormat.getTimeInstance();
        }
        format.setLenient(false);
        return format.format(value);
    }
}

From source file:com.bdb.weather.display.day.DayPressurePane.java

@Override
public List<SeriesControl> configure(Menu menu) {
    List<SeriesControl> controls = new ArrayList<>();
    controls.add(new SeriesControl(HistoricalSeriesInfo.BAROMETER_SERIES, true));
    controls.add(new SeriesControl(HistoricalSeriesInfo.HIGH_SOLAR_RADIATION_SERIES, true, false));

    XYToolTipGenerator ttg = new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            DateFormat.getTimeInstance(), Pressure.getDefaultFormatter());
    getPlot().getRenderer(0).setBaseToolTipGenerator(ttg);
    ttg = new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            DateFormat.getTimeInstance(), SolarRadiation.getDefaultFormatter());
    getPlot().getRenderer(1).setBaseToolTipGenerator(ttg);

    return controls;
}

From source file:ftpclientgui.MainWindow.java

private void init() {
    this.labTime.setText(DateFormat.getTimeInstance().format(new Date()));
    this.labStatus.setText("Not logged in.");
    this.dirList.addSelectionListener(this);
    tmr = new Timer(950, this);
    tmr.start();/*from   www.  j a v  a2s. c o m*/
}

From source file:org.onebusaway.nyc.webapp.actions.admin.VehiclesAction.java

public String getCurrentTimestamp() {
    Date now = new Date();
    return DateFormat.getDateInstance().format(now) + " " + DateFormat.getTimeInstance().format(now);
}