打赏

java编程如何实现2017-01-16 22:28:26.0这样的时间数据,转换成2017:01:16:22:28:26这样的时间数据

 

 

  不多说,直接上干货!

 

 

 

 

 

 

timereplace.java

package zhouls.bigdata.DataFeatureSelection.util;

/*
 * 这个程序,是用来做补充的
 */
public class timereplace {

     public static void main(String[] args) {
         
            String rawtime = "2017-01-16 22:28:26.0";
            String rawtime1 = rawtime.replaceAll("-", ":");//2017:01:16 22:28:26.0
            String rawtime2 = rawtime1.replaceAll(" ", ":");//2017:01:16:22:28:26.0
            System.out.println(rawtime2.substring(0, 19)); //打印字符串2017:01:16:22:28:26
        }
     
}

 

posted @ 2017-09-15 21:28  大数据和AI躺过的坑  阅读(195)  评论(0编辑  收藏  举报