Java Time Readable Format toTimeStampString(String timeStr)

Here you can find the source of toTimeStampString(String timeStr)

Description

to Time Stamp String

License

Apache License

Declaration

public static String toTimeStampString(String timeStr) 

Method Source Code

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

public class Main {

    public static String toTimeStampString(String timeStr) {
        String result = "";
        // TimeZone tz = TimeZone.getDefault();
        // GregorianCalendar c = new GregorianCalendar(tz);
        result += timeStr.substring(0, 4);
        result += "-";
        result += timeStr.substring(4, 6);
        result += "-";
        result += timeStr.substring(6, 8);

        if (timeStr.length() > 8) {
            result += " " + timeStr.substring(8, 10);
            result += ":";
            result += timeStr.substring(10, 12);
            result += ":";
            result += timeStr.substring(12, 14);
        }//from   w w  w. j  a  v a2  s  . c o  m
        return result;
    }
}

Related

  1. toTimeExpression(long ms, int frames)
  2. toTimeFormat(String _srcTime)
  3. toTimeHumanReadable(final long time)
  4. toTimeSpanDescription(long time)
  5. toTimestamp(long time)
  6. toTimeString(double millis)
  7. toTimeString(long frame)
  8. toTimeString(long millis)
  9. toTimeString(long millis, boolean showSeconds, String separatorHours, String separatorMin, String separatorSec)