unix YYYYMMDDHHMMSS.miliseconds format to java date -


i want date without time in java

unix format

yyyymmddhhmmss.miliseconds

unix string 20170817134131.384

string val = "20170817134131.384";         if (val != null) {             simpledateformat df = new simpledateformat("yyyymmddhhmmss");             try {                 date = df.parse(string.valueof(val));             } catch (parseexception e) {                 throw new runtimeexception("failed parse date: ", e);             }             return date;         } 

here's simple solution convert unix time localdate , you're free format please:

long time = 1491231860; final localdate localdate = localdate.frommillissinceepoch(unixseconds); 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -