Timestamp to string date

前端 未结 3 535
忘掉有多难
忘掉有多难 2021-02-04 01:53

I don\'t know how to transform timestamp to date. I have:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setConten         


        
3条回答
  •  天命终不由人
    2021-02-04 02:20

    String S = "1350574775";
    

    You are sending your timestamp in seconds, instead of milliseconds.

    Do this, instead:

    String S = "1350574775000";
    

    Or, in your getDate method, multiply by 1000L:

    new Date(Long.parseLong(timeStampStr) * 1000L)
    

提交回复
热议问题