Java Date Format As formatDateHMS(java.util.Date date)

Here you can find the source of formatDateHMS(java.util.Date date)

Description

format Date HMS

License

Open Source License

Declaration

public static String formatDateHMS(java.util.Date date) 

Method Source Code

//package com.java2s;
/**/*from w w w  .j av  a 2 s.  co  m*/
 *  Copyright (c) 2011, Eryptogram.java TAIHEIOT and/or its affiliates. All rights reserved.
 *
 *  Licensed under the TAIHEIOT License, Version 1.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

import java.text.SimpleDateFormat;

public class Main {

    public static String formatDateHMS(java.util.Date date) {
        String result = "";
        if (date != null) {
            try {
                SimpleDateFormat dateFormater = new SimpleDateFormat("HH:mm:ss");
                result = dateFormater.format(date);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        return result;
    }
}

Related

  1. formatDateForTAP(Date date)
  2. formatDateForXpath(Date date)
  3. formatDateGMT(Date date)
  4. formatDateHeader(final Date date)
  5. formatDateHeader(final Date date)
  6. formatDateHMSMZ(Date date)
  7. formatDateList(List dateList)
  8. formatDateMedium(Date date)
  9. formatDatemhs(java.util.Date date)