List of usage examples for java.util Calendar getTime
public final Date getTime()
Date
object representing this Calendar
's time value (millisecond offset from the Epoch"). From source file:Main.java
public static String getTimeMillisToFullDate2(long milliSeconds) { Calendar cal = Calendar.getInstance(); java.util.Date currentTime = cal.getTime(); // Create a DateFormatter object for displaying date in specified format. SimpleDateFormat formatter = new SimpleDateFormat(FORMATE_YYYY_MM_DDHHMMSS_FULL); // String ndate = formatter.format(currentTime); // Create a calendar object that will convert the date and time value in milliseconds to date. cal.setTimeInMillis(milliSeconds);/*from w w w .jav a 2 s . c o m*/ return formatter.format(cal.getTime()); }
From source file:Main.java
public static java.util.Date getDateFromDatePicker(DatePicker datePicker) { int day = datePicker.getDayOfMonth(); int month = datePicker.getMonth(); int year = datePicker.getYear(); Calendar calendar = Calendar.getInstance(); calendar.set(year, month, day);/*from www.j av a 2s .c o m*/ return calendar.getTime(); }
From source file:Main.java
public static String getFlushWeek() { Calendar cal = Calendar.getInstance(); String stringDate = new SimpleDateFormat("yyyy/MM/dd ").format(cal.getTime()); return stringDate; }
From source file:Main.java
public static String getFlushDate() { Calendar cal = Calendar.getInstance(); String stringDate = new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime()); return stringDate; }
From source file:Main.java
public static String getDateYyyyMmDd() { Calendar cal = Calendar.getInstance(); java.util.Date currentTime = cal.getTime(); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); String ndate = formatter.format(currentTime); return ndate; }
From source file:Main.java
public static String getFormattedDate(Calendar cal) { SimpleDateFormat sdf = new SimpleDateFormat("d MMMM yyyy, h a"); return sdf.format(cal.getTime()); }
From source file:Main.java
public static String parseDay(long dateDay) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(dateDay);/*from www .j ava 2 s. c o m*/ Date date = calendar.getTime(); return formarDay.format(date); }
From source file:Main.java
public static Date getDate(final Date aDate) { try {/* www . j a v a 2 s .c om*/ Calendar calDate = Calendar.getInstance(); calDate.setTime(aDate); return calDate.getTime(); } catch (Exception ex) { System.out.println("HelperTool.getDate(): " + ex.toString()); return null; } }
From source file:Main.java
public static String convertLongToString(long time, String format) { String myDate = null;//from www . j a v a2 s . com SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern(format); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); Date date = calendar.getTime(); myDate = sdf.format(date); return myDate; }
From source file:Main.java
public static String getFormattedString(Calendar calendar) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date date = calendar.getTime(); return dateFormat.format(date); }