Java tutorial
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; public class Main { public static String getSysDateTimeMillis() { String str = new Timestamp(System.currentTimeMillis()).toString(); if (str.length() >= 23) { return str.substring(0, 23); } else { StringBuilder sb = new StringBuilder(); sb.append(str); for (int i = 0; i < 23 - str.length(); i++) { sb.append("0"); } return sb.toString(); } } }