Java Today getTodayHHmmss(String HHmmss)

Here you can find the source of getTodayHHmmss(String HHmmss)

Description

get Today H Hmmss

License

Apache License

Declaration

public static Date getTodayHHmmss(String HHmmss) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date getTodayHHmmss(String HHmmss) {

        String[] array = HHmmss.split(":");
        Calendar calendar = Calendar.getInstance();

        calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(array[0]));
        calendar.set(Calendar.MINUTE, Integer.valueOf(array[1]));
        calendar.set(Calendar.SECOND, Integer.valueOf(array[2]));

        return calendar.getTime();

    }/*www.  j  a  v a2  s . com*/

    public static Date getTodayHHmmss(Date date) {

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        String str = "";

        str = str + calendar.get(Calendar.HOUR_OF_DAY) + ":";
        str = str + calendar.get(Calendar.MINUTE) + ":";
        str = str + calendar.get(Calendar.SECOND);

        return getTodayHHmmss(str);

    }
}

Related

  1. getToDayEndTime()
  2. getTodayFolder()
  3. getTodayFormat(String format)
  4. getTodayFormatString(String pattern)
  5. getTodayFormatted(String pattern)
  6. getTodayInFormat(String format)
  7. getTodayIntevalDays(String date)
  8. getTodayLast()
  9. getTodayLastSecond()