List of utility methods to do Date Create
Date | date(int year, int month, int day, int hour, int minute, int second) date Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day, hour, minute, second);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
|
Date[] | longArrayTODateArray(long[] dates_s, SimpleDateFormat dateformat) long Array TO Date Array if (dates_s == null) { return null; Date[] dates = new Date[dates_s.length]; for (int i = 0; i < dates_s.length; i++) { dates[i] = new Date(dates_s[i]); return dates; |
String | longToDate(long time) Parsing long value to the Date format Date date = new Date(time); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); return format.format(date); |
Date | objectToDate(Object Obj) object To Date SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy-MM-dd"); Date aux = null; try { aux = formatoDelTexto.parse(objectToString(Obj)); } catch (Exception ex) { return aux; |
String | timeToDate() time To Date Calendar cal = Calendar.getInstance(); SimpleDateFormat dateParser = new SimpleDateFormat("MMM d HH:mm:ss", Locale.getDefault()); return dateParser.format(cal.getTime()); |
String | toDate() to Date Date date = new Date(); return daysParse.format(date); |
String | toDate() to Date return toDate(new Date()); |
String | toDate(Calendar date) to Date String dateFormatted = ""; if (date != null) { dateFormatted = sdfDate.format(date.getTime()); return dateFormatted; |
String | toDate(Date d) to Date SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); StringBuilder fieldDate = new StringBuilder(simpleDateFormat.format(d)); return fieldDate.toString(); |
Date | toDate(final Calendar calendar) To date. Date date = new Date(); date = calendar.getTime(); return date; |