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
Post a Comment