Unix timestamp and system millisecond conversion

I have made a low-level mistake these days, and I have been adjusting the WeChat check-in API, but it is empty. The first thing I think of is that the status code is correct, then the token error, secret error, and the personnel number are not wrong. It's time. The result has not been resolved. It turns out that the timestamp is not milliseconds, but seconds, ah ah. Attach the conversion code below

 

  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date start_date = sdf.parse("2019-11-08");
            Date end_date = sdf.parse("2019-11-16");
            Long startT = start_date.getTime()/1000;
            Long endT = end_date.getTime()/1000;


  //也就是时间戳=毫秒/1000  毫秒=时间戳*1000

 

Published 51 original articles · Like 4 · Visitors 7889

Guess you like

Origin blog.csdn.net/u012174809/article/details/103099563