List of usage examples for java.util GregorianCalendar GregorianCalendar
public GregorianCalendar()
GregorianCalendar
using the current time in the default time zone with the default Locale.Category#FORMAT FORMAT locale. From source file:Main.java
public static String getTimeStampDDMMYYYY(long l) { Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(l);/*from w w w . j a v a 2s .c om*/ return makeTimeString(cal.get(Calendar.DAY_OF_MONTH), 2) + "." + makeTimeString(cal.get(Calendar.MONTH) + 1, 2) + "." + makeTimeString(cal.get(Calendar.YEAR), 4); }
From source file:Main.java
public static String getCurrentTimeStampDD_MM_YYYY() { Calendar cal = new GregorianCalendar(); return makeTimeString(cal.get(Calendar.DAY_OF_MONTH), 2) + "." + makeTimeString(cal.get(Calendar.MONTH) + 1, 2) + "." + makeTimeString(cal.get(Calendar.YEAR), 4); }
From source file:Main.java
public static String getCurrentTimeStampDD_MM_HH_MM() { Calendar cal = new GregorianCalendar(); return makeTimeString(cal.get(Calendar.DAY_OF_MONTH), 2) + "." + makeTimeString(cal.get(Calendar.MONTH) + 1, 2) + ". " + makeTimeString(cal.get(Calendar.HOUR_OF_DAY), 2) + ":" + makeTimeString(cal.get(Calendar.MINUTE), 2); }
From source file:Main.java
public static GregorianCalendar getGregorianCalendarFromEsmartString(String _esmart) { GregorianCalendar res = new GregorianCalendar(); res.setTime(getDateFromEsmartString(_esmart)); return res;//from w ww . j a v a 2 s. c o m }
From source file:Main.java
public static XMLGregorianCalendar getXMLGregorianCalendarTimestamp() { try {/*from w w w . j av a2 s. c om*/ DatatypeFactory dtf = DatatypeFactory.newInstance(); GregorianCalendar gc = new GregorianCalendar(); return dtf.newXMLGregorianCalendar(gc); } catch (DatatypeConfigurationException e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static String getCurrentTimeStampYYYY_MM_DD_HH_MM_SS() { Calendar cal = new GregorianCalendar(); return makeTimeString(cal.get(Calendar.YEAR), 4) + "/" + makeTimeString(cal.get(Calendar.MONTH) + 1, 2) + "/" + makeTimeString(cal.get(Calendar.DAY_OF_MONTH), 2) + " " + makeTimeString(cal.get(Calendar.HOUR_OF_DAY), 2) + ":" + makeTimeString(cal.get(Calendar.MINUTE), 2) + ":" + makeTimeString(cal.get(Calendar.SECOND), 2); }
From source file:Main.java
public static XMLGregorianCalendar xmlGregorianCalendar() throws DatatypeConfigurationException { GregorianCalendar cal = new GregorianCalendar(); return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); }
From source file:Main.java
static Date getExpirationDate(int tokenExpiredDateInMinuite) { final Calendar expiredTime = new GregorianCalendar(); // access token is only valid for a hour expiredTime.add(Calendar.MINUTE, tokenExpiredDateInMinuite); return expiredTime.getTime(); }
From source file:Main.java
public static String getFormatDateAdd(Date date, int amount, String format) { Calendar cal = new GregorianCalendar(); cal.setTime(date);//from w w w . jav a 2s . c om cal.add(GregorianCalendar.DATE, amount); return getFormatDateTime(cal.getTime(), format); }
From source file:Main.java
public static XMLGregorianCalendar toXMLGregorianCalendar(Date date) { if (date == null) return null; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date);/*from ww w . j av a 2s . c om*/ return newInstance.newXMLGregorianCalendar(calendar); }