List of usage examples for java.text DateFormat getDateTimeInstance
public static final DateFormat getDateTimeInstance()
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(); String s = dateFormat.format(new Date()); System.out.println(dateFormat.isLenient()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(); String s = dateFormat.format(new Date()); System.out.println(dateFormat.getTimeZone()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(); String s = dateFormat.format(new Date()); System.out.println(s);//from w w w . ja va2 s .c om }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(); String s = dateFormat.format(new Date()); System.out.println(dateFormat.getCalendar()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(); String s = dateFormat.format(new Date()); System.out.println(dateFormat.hashCode()); }
From source file:Main.java
public static void main(String[] args) { Date now = new Date(); DateFormat defaultFormat = DateFormat.getDateTimeInstance(); String defaultString = defaultFormat.format(now); System.out.println("Default : " + defaultString); DateFormat antarcticaFormat = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, new Locale("en", "AQ")); String antarcticaString = antarcticaFormat.format(now); System.out.println("Antarctica: " + antarcticaString); }
From source file:AntarcticaLocaleDemo.java
public static void main(String [] args) { Date now = new Date(); DateFormat defaultFormat = DateFormat.getDateTimeInstance(); String defaultString = defaultFormat.format (now); System.out.println ("Default : " + defaultString); DateFormat antarcticaFormat = DateFormat.getDateTimeInstance ( DateFormat.FULL, DateFormat.FULL, new Locale ("en", "AQ")); String antarcticaString = antarcticaFormat.format (now); System.out.println ("Antarctica: " + antarcticaString); }
From source file:com.netdimensions.sample.Enrollments.java
public static void main(String[] args) throws IOException { final Client client = new Client(args[0], new UsernamePasswordCredentials(args[1], args[2])); try {// ww w . ja v a 2 s. co m // This comment added on Dell Studio // This comment also added on Dell Studio // Third comment added on Dell Studio // Fourth comment added via browser // Fifth comment added via browser final List<Record> enrollments = client.send(Commands.getEnrollments()); for (Record e : sorted(enrollments, new Comparator<Record>() { @Override public int compare(Record o1, Record o2) { return o2.enrollmentDate.compareTo(o1.enrollmentDate); } })) { System.out.println(e.learningModule.title + " (" + DateFormat.getDateTimeInstance().format(e.enrollmentDate) + ")"); } } finally { client.close(); } }
From source file:com.auditbucket.client.Importer.java
public static void main(String args[]) { try {//from w w w .j a v a2 s.c o m ArgumentParser parser = ArgumentParsers.newArgumentParser("ABImport").defaultHelp(true) .description("Import file formats to AuditBucket"); parser.addArgument("-s", "--server").setDefault("http://localhost/ab-engine") .help("Host URL to send files to"); parser.addArgument("-b", "--batch").setDefault(100).help("Default batch size"); parser.addArgument("-x", "--xref").setDefault(false).help("Cross References Only"); parser.addArgument("files").nargs("*").help( "Path and filename of Audit records to import in the format \"[/filepath/filename.ext],[com.import.YourClass],{skipCount}\""); Namespace ns = null; try { ns = parser.parseArgs(args); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } List<String> files = ns.getList("files"); if (files.isEmpty()) { parser.handleError(new ArgumentParserException("No files to parse", parser)); System.exit(1); } String b = ns.getString("batch"); int batchSize = 100; if (b != null && !"".equals(b)) batchSize = Integer.parseInt(b); StopWatch watch = new StopWatch(); watch.start(); logger.info("*** Starting {}", DateFormat.getDateTimeInstance().format(new Date())); long totalRows = 0; for (String file : files) { int skipCount = 0; List<String> items = Arrays.asList(file.split("\\s*,\\s*")); if (items.size() == 0) parser.handleError(new ArgumentParserException("No file arguments to process", parser)); int item = 0; String fileName = null; String fileClass = null; for (String itemArg : items) { if (item == 0) { fileName = itemArg; } else if (item == 1) { fileClass = itemArg; } else if (item == 2) skipCount = Integer.parseInt(itemArg); item++; } logger.debug("*** Calculated process args {}, {}, {}, {}", fileName, fileClass, batchSize, skipCount); totalRows = totalRows + processFile(ns.get("server").toString(), fileName, (fileClass != null ? Class.forName(fileClass) : null), batchSize, skipCount); } endProcess(watch, totalRows); logger.info("Finished at {}", DateFormat.getDateTimeInstance().format(new Date())); } catch (Exception e) { logger.error("Import error", e); } }
From source file:Main.java
public static String getNowTime() { Date now = new Date(); DateFormat df = DateFormat.getDateTimeInstance(); String nowtime = df.format(now); return nowtime; }