Java Utililty Methods Date Start

List of utility methods to do Date Start

Description

The list of methods to do Date Start are organized into topic(s).

Method

DategetStartTimeOfDay(Date date)
 Start time of the given date, specific to the second. 
Date result = null;
if (date != null) {
    Calendar calendar = getCalendar(date);
    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH);
    int day = calendar.get(Calendar.DATE);
    calendar.set(year, month, day, 0, 0, 0);
    calendar.set(Calendar.MILLISECOND, 0);
...
DategetStartTimeOfDay(Date date)
Get the start time date-time of the given day (ie.
Calendar currentCalendar = new GregorianCalendar();
currentCalendar.setTime(date);
currentCalendar.set(HOUR_OF_DAY, 0);
currentCalendar.set(MINUTE, 0);
currentCalendar.set(SECOND, 0);
return currentCalendar.getTime();
DategetStrDateToDate(String dateStr)
get Str Date To Date
String dateSplit = getDateSplit();
if (dateSplit.equals("."))
    dateSplit = "\\.";
StringTokenizer filter = new StringTokenizer(dateStr, dateSplit);
int year = Integer.parseInt(filter.nextToken());
int mon = Integer.parseInt(filter.nextToken()) - 1;
int day = Integer.parseInt(filter.nextToken());
Calendar cal = new GregorianCalendar(year, mon, day);
...
StringgetStringDate()
get String Date
Calendar calendar = Calendar.getInstance();
StringBuffer sb = new StringBuffer();
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
sb.append(calendar.get(Calendar.YEAR));
if (month < 10) {
    sb.append(0);
    sb.append(month);
...
longgetStringDate(byte[] block, int pos)
get String Date
int i = pos - 1;
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, toInt(block, i, 4));
cal.set(Calendar.MONTH, toInt(block, (i = i + 4), 2) - 1);
cal.set(Calendar.DATE, toInt(block, (i = i + 2), 2));
cal.set(Calendar.HOUR_OF_DAY, toInt(block, (i = i + 2), 2));
cal.set(Calendar.MINUTE, toInt(block, (i = i + 2), 2));
cal.set(Calendar.SECOND, toInt(block, (i = i + 2), 2));
...
CalendargetStringInDate(String dateString)
get String In Date
String[] split = dateString.split("/");
return new GregorianCalendar(Integer.parseInt(split[2]), Integer.parseInt(split[1]) - 1,
        Integer.parseInt(split[0]));