반응형
long 타입의 타임스탬프를 시간으로 변환시켜보자.
public String toTimeStamp(long num){
Date toTimeStamp = new Date(num);
SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd hh:mm", Locale.getDefault());
return datef.format(toTimeStamp) ;
}
나같은 경우는 String으로 리턴받아 TextView에 띄워주었다.
원하는대로 활용해보자.
'소프트웨어 > 안드로이드[Java]' 카테고리의 다른 글
[Android] Retrofit 에러 - Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ (0) | 2021.06.05 |
---|---|
[Android] Collapsing Toolbar Layout 텍스트 안나올 때 (0) | 2021.04.20 |
[Android] android.database.CursorIndexOutOfBoundsException (0) | 2021.04.06 |
[Android] BottomNavigationView Fragment 적용 (2) | 2021.04.02 |
[Android] BottomNavigationView 구현하기 (0) | 2021.04.01 |