Android Time Get nowAsTime()

Here you can find the source of nowAsTime()

Description

now As Time

Declaration

public static Time nowAsTime() 

Method Source Code

//package com.java2s;
import java.sql.Time;

import java.util.Calendar;

public class Main {
    public static Time nowAsTime() {
        Calendar objCurrentCalendar = Calendar.getInstance();
        StringBuffer sbTimeString = new StringBuffer();
        int iHourOfDay = objCurrentCalendar.get(Calendar.HOUR_OF_DAY);
        int iMinute = objCurrentCalendar.get(Calendar.MINUTE);
        int iSecond = objCurrentCalendar.get(Calendar.SECOND);
        sbTimeString.append(iHourOfDay);
        sbTimeString.append(":");
        sbTimeString.append(iMinute);/* ww w. j a  v  a 2s. co m*/
        sbTimeString.append(":");
        sbTimeString.append(iSecond);
        return java.sql.Time.valueOf(sbTimeString.toString());
    }
}

Related

  1. getDateTimeFromCal(Calendar cal)
  2. getTimeStr(Date date)
  3. getTimeString(String strTime)
  4. getNowDateTime()
  5. getTimeAsInt()
  6. getCurrentTimeCalendar()
  7. getCurrentTimeStr()
  8. getCurrentTimeString()
  9. getTime()