Example usage for java.text DateFormat DEFAULT

List of usage examples for java.text DateFormat DEFAULT

Introduction

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

Prototype

int DEFAULT

To view the source code for java.text DateFormat DEFAULT.

Click Source Link

Document

Constant for default style pattern.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    String s = DateFormat.getDateInstance(DateFormat.DEFAULT).format(new Date());
    System.out.println(s);/*from  ww  w  . j  a  v a2  s.c  o  m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Date date = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Feb 28, 2002");
    System.out.println(date);//from www  .  j a  va2s. c  om
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.DEFAULT).format(date);
    System.out.println(strDate);//w  w  w  .jav a  2 s  . co  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Date date = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).parse("21.33.03");
    System.out.println(date);//from   w ww . ja v  a  2 s . c  o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    String s = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).format(new Date());
    System.out.println(s);/*from ww  w  .j a va2  s.c o m*/

}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();

    String strDate = DateFormat.getDateInstance(DateFormat.DEFAULT).format(date);
    System.out.println(strDate);/* w  w  w.ja va2  s .c om*/

    strDate = DateFormat.getDateInstance(DateFormat.FULL).format(date);
    System.out.println(strDate);

    strDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
    System.out.println(strDate);

    strDate = DateFormat.getDateInstance(DateFormat.SHORT).format(date);
    System.out.println(strDate);
}

From source file:com.hp.mqm.atrf.Main.java

public static void main(String[] args) {

    long start = System.currentTimeMillis();
    setUncaughtExceptionHandler();// ww w .  j  ava 2 s. c o  m

    CliParser cliParser = new CliParser();
    cliParser.handleHelpAndVersionOptions(args);

    configureLog4J();
    logger.info(System.lineSeparator() + System.lineSeparator());
    logger.info("************************************************************************************");
    DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.getDefault());
    DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.getDefault());
    logger.info((String.format("Starting HPE ALM Test Result Collection Tool %s %s",
            dateFormatter.format(new Date()), timeFormatter.format(new Date()))));
    logger.info("************************************************************************************");

    FetchConfiguration configuration = cliParser.parse(args);
    ConfigurationUtilities.setConfiguration(configuration);

    App app = new App(configuration);
    app.start();

    long end = System.currentTimeMillis();
    logger.info(String.format("Finished creating tests and test results on ALM Octane in %s seconds",
            (end - start) / 1000));
    logger.info(System.lineSeparator());
}

From source file:Main.java

public static String getFormatDateStr(final Date date) {
    if (null == date) {
        return null;
    }//from   www .ja  v  a 2 s  .c o  m
    return DateFormat.getDateInstance(DateFormat.DEFAULT).format(date);
}

From source file:Main.java

private static String generateTimeTagMessageLog(String tag, String msg) {
    final String log = String.format("%s: %s: %s",
            SimpleDateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CHINA).format(new Date()), tag, msg);
    return log;//from ww  w. j a  va  2  s.  co  m
}

From source file:Main.java

public static String getDateCurrentTimeZone() {
    StringBuilder sb = new StringBuilder();
    try {/*w  w w . ja  v  a 2 s . co  m*/
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT,
                Locale.getDefault());
        Date currentTimeZone = calendar.getTime();
        sb.append(dateFormat.format(currentTimeZone));
    } catch (Exception e) {
        e.printStackTrace();
    }
    return sb.toString();
}