Here you can find the source of formatToTimeStr(String str)
Parameter | Description |
---|---|
str | String to be converted |
public static String formatToTimeStr(String str)
//package com.java2s; /*//from ww w .j a va 2 s. co m * File: $RCSfile$ * * Copyright (c) 2005 Wincor Nixdorf International GmbH, * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany * All Rights Reserved. * * This software is the confidential and proprietary information * of Wincor Nixdorf ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered * into with Wincor Nixdorf. */ public class Main { /** * format str to time str (hh:mm) * * @param str String to be converted * @return String */ public static String formatToTimeStr(String str) { String result = ""; if (str != null && str.length() > 0) { try { result = str.substring(0, 2) + ":" + str.substring(2); } catch (Exception e) { e.printStackTrace(); result = str; } } return result; } }