简体   繁体   中英

In App purchase response which purchase time, convert this timestamp value to date format?

In-App purchase response, as purchase time, how to convert this timestamp to date format, the problem I am facing is the value of timestamp is exceeding long data type limit? kindly explain how to finad the date from timestamp in this case?

You are trying to parse a timestamp with SimpleDateFormat using an incorrect format string "MMddyyHHmmss". The timestamp value returned is expressed in "milliseconds since the epoch (Jan 1, 1970)". Parse the string to its long value and create a Date object directly from that:

Date date = new Date(Long.parseLong(timestampString)); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM