[Java] - Millisecond to time
Java 2018. 7. 19. 09:45private String getTimeStamp( long milliSeconds ) {
long time = milliSeconds / 1000;
String seconds = Integer.toString( ( int )( time % 60 ) );
String minutes = Integer.toString( ( int )( ( time % 3600 ) / 60 ) );
String hours = Integer.toString( ( int )( time / 3600 ) );
for( int i = 0; i < 2; i++ ) {
if( seconds.length() < 2 ) {
seconds = "0" + seconds;
}
if( minutes.length() < 2 ) {
minutes = "0" + minutes;
}
if( hours.length() < 2 ) {
hours = "0" + hours;
}
}
String ddate = hours + ":" + minutes + ":" + seconds;
return ddate;
}
'Java' 카테고리의 다른 글
[Spring] - json 406 error (0) | 2019.01.03 |
---|---|
[Spring] - @RequestParam 사용 / 400 Error (0) | 2018.12.13 |
[Java] - replaceAll (.) dot 점 치환 (0) | 2018.01.30 |
[SpringBoot] - @Autowired 변수 static 선언방법 (0) | 2017.07.05 |
[SpringBoot] - Mybatis configuration.xml 항목 순서 (0) | 2017.07.05 |