Java Date to Time getTime(Date date)

Here you can find the source of getTime(Date date)

Description

get Time

License

BSD License

Declaration

public static String[] getTime(Date date) 

Method Source Code

//package com.java2s;
/*L//from w w w  .j  av  a2  s.c o  m
 * Copyright Washington University in St. Louis, SemanticBits, Persistent Systems, Krishagni.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/wustl-common-package/LICENSE.txt for details.
 */

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static String[] getTime(Date date) {
        String[] time = new String[2];
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        time[0] = Integer.toString(cal.get(Calendar.HOUR_OF_DAY));
        time[1] = Integer.toString(cal.get(Calendar.MINUTE));
        return time;
    }

    public static String toString(Object obj) {
        if (obj == null)
            return "";

        return obj.toString();
    }
}

Related

  1. getFriendlyTimeString(Date date)
  2. getMediumDateString(Date date, boolean includeTime)
  3. getMSDateTimeString(Date date)
  4. getTime(Date date)
  5. getTime(Date date)
  6. getTime(Date date)
  7. getTime(Date date)
  8. getTime(Date date)
  9. getTime(Date date)