We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesApplication ServicesPayment KitAppendix

Appendix

Example of Obtaining the UTC Expiration Time

Collapse
Word wrap
Dark theme
Copy code
  1. /**
  2. * Obtain the expiration time in UTC format.
  3. * @param expectedExpiredTime: Transaction expiration time, in minutes.
  4. * @return: UTC time.
  5. */
  6. private static String getTradeExpireTime(int expectedExpiredTime) {
  7. SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
  8. formater.setTimeZone(TimeZone.getTimeZone("UTC"));
  9. Calendar calendar = Calendar.getInstance();
  10. calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE) + expectedExpiredTime);
  11. return formater.format(calendar.getTime());
  12. }
Search in References
Enter a keyword.