Here you can find the source of formate8Date(String str)
Parameter | Description |
---|---|
str | a parameter |
public static String formate8Date(String str)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww . j a v a 2 s . c o m*/ * * @param str * @return */ public static String formate8Date(String str) { if (str.length() == 8) { return str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8); } return str; } }