List of usage examples for java.util Date toString
public String toString()
where:dow mon dd hh:mm:ss zzz yyyy
From source file:Main.java
public static String changeStringToDate1(String str) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date date6 = null; try {// w w w. ja v a 2s . co m date6 = sdf.parse(str); return date6.toString(); } catch (ParseException e) { e.printStackTrace(); return ""; } }
From source file:Main.java
public static String formatDate(String date, String format) { // "ddd MM, yyyy" DateFormat sdf = new SimpleDateFormat(format, Locale.getDefault()); Date parsedDate = new Date(); try {/*from w w w . j a va 2 s.c om*/ parsedDate = sdf.parse(date); parsedDate.toString(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ""; }
From source file:org.loklak.api.search.TimeAndDateService.java
public static SusiThought timeAndDate() { JSONObject timeAndDate = new JSONObject(); Date time_and_date = new Date(); timeAndDate.put("time_and_date", time_and_date.toString()); JSONArray jsonArray = new JSONArray(); jsonArray.put(timeAndDate);// w w w . j a v a2s.c om SusiThought result = new SusiThought(); result.setData(jsonArray); return result; }
From source file:storybook.ui.chart.jfreechart.ChartUtil.java
public static Marker getDateMarker(Date paramDate) { return getDateMarker(paramDate, paramDate.toString()); }
From source file:storybook.ui.chart.jfreechart.ChartUtil.java
public static Marker getDateIntervalMarker(Date paramDate1, Date paramDate2) { String str = paramDate1.toString() + " - " + paramDate2.toString(); return getDateIntervalMarker(paramDate1, paramDate2, str); }
From source file:Main.java
private static Boolean currentGreaterThenOld(String currentDate, String oldDate) { if (currentDate.isEmpty() || oldDate.isEmpty()) return false; try {/*from ww w. j a va 2 s . com*/ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); Date current = formatter.parse(currentDate); Date old = formatter.parse(oldDate); if (old.compareTo(current) < 0) { Log.d(TAG, "compareDate current Date : " + current.toString() + " is greater then Old Date : " + old.toString()); return true; } } catch (ParseException e1) { e1.printStackTrace(); } return false; }
From source file:oeg.licensius.core.Licensius.java
/** * Initializes the logger It is configured by default so that there is an * output in console and in file/*from w w w.j a va 2 s.co m*/ * * @param on Indica si se desean logs (true) o no (false) * @param console Indica si se desea adems una salida por consola o no */ public static void initLogger(boolean on, boolean console) { if (!on) { logger.setLevel(Level.OFF); } else { BasicConfigurator.configure(); PatternLayout layout = new PatternLayout("%d{ABSOLUTE} %5p %C{1}:%L - %m%n"); FileAppender appender = null; try { appender = new FileAppender(layout, "licensius-core.log", false); } catch (Exception e) { e.printStackTrace(); } logger.addAppender(appender); if (console) { ConsoleAppender ca = new ConsoleAppender(); ca.setWriter(new OutputStreamWriter(System.out)); ca.setLayout(layout); ca.setName("consola"); logger.addAppender(ca); } logger.setLevel((Level) Level.DEBUG); } logger.info("Executed at " + new Date().toString() + " in " + SystemInformation.nombrePC() + " - Starting logger"); Date d = SystemInformation.getCompileTimeStamp(Licensius.class); logger.info("Compiled at: " + d.toString()); logger.info("========================================================="); }
From source file:DateParser.java
public static void test(String isodate) { System.out.println("----------------------------------"); Date date = parse(isodate); System.out.println(">> " + isodate); System.out.println(">> " + date.toString() + " [" + date.getTime() + "]"); System.out.println(">> " + getIsoDate(date)); System.out.println("----------------------------------"); }
From source file:DateParser.java
public static void test(Date date) { String isodate = null;/*from w w w . j ava2 s . c o m*/ System.out.println("----------------------------------"); System.out.println(">> " + date.toString() + " [" + date.getTime() + "]"); isodate = getIsoDate(date); System.out.println(">> " + isodate); date = parse(isodate); System.out.println(">> " + date.toString() + " [" + date.getTime() + "]"); System.out.println("----------------------------------"); }
From source file:com.cloud.utils.storage.S3.S3Utils.java
public static URL generatePresignedUrl(final ClientOptions clientOptions, final String bucketName, final String key, final Date expiration) { LOGGER.debug(format("Generating presigned url for key %1s in bucket %2s with expiration date %3s", key, bucketName, expiration.toString())); return getTransferManager(clientOptions).getAmazonS3Client().generatePresignedUrl(bucketName, key, expiration, HttpMethod.GET); }