List of usage examples for java.util Date Date
public Date()
From source file:MainClass.java
public static void main(String[] args) { //Format Date into SMTP_DATETIME_FORMAT System.out.println("2) SMTP_DATETIME_FORMAT >>>" + DateFormatUtils.SMTP_DATETIME_FORMAT.format(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault()); String s = dateFormat.format(new Date()); System.out.println(s);/*w w w . ja v a 2 s . co m*/ }
From source file:Main.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); // get the current time System.out.println("Current time is :" + cal.getTime()); Date date = new Date(); cal.setTime(date);//from w w w.j ava2 s . c o m // print the new time System.out.println("After setting Time: " + cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { java.sql.Timestamp ts1 = java.sql.Timestamp.valueOf("2012-04-06 09:01:10"); java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2013-04-06 09:01:10"); System.out.println(ts1.compareTo(new Date())); }
From source file:Main.java
public static void main(String[] args) { String strDateFormat = "dd"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); System.out.println("Current day in dd format : " + sdf.format(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JFormattedTextField tft3 = new JFormattedTextField(new SimpleDateFormat("yyyy-M-d")); tft3.setValue(new Date()); Date date = (Date) tft3.getValue(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat(); formatter.applyPattern("MMM"); String s = formatter.format(new Date()); System.out.println(s);//w w w.j av a2 s.c o m }
From source file:Main.java
public static void main(String[] argv) { Object activeValue = new UIDefaults.ActiveValue() { public Object createValue(UIDefaults table) { return new Date(); }// w w w . j a va2 s. co m }; UIManager.put("key", activeValue); Date d1 = (Date) UIManager.get("key"); Date d2 = (Date) UIManager.get("key"); boolean b = d1.equals(d2); // false }
From source file:Main.java
public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("yy"); formatter.set2DigitYearStart(new Date()); System.out.println(formatter.format(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateInstance(); StringBuffer sb = new StringBuffer(); sb = dateFormat.format(new Date(), sb, new FieldPosition(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD)); System.out.println(sb);//from w w w. jav a 2 s .co m }