SHARE
TWEET

Untitled

a guest Jun 26th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static Date convertToGMT(String datetime) {    
  2.         DateTimeFormatter formatter = null;
  3.         if(datetime.contains("GMT")){
  4.          formatter = DateTimeFormat.forPattern("E MMM dd yyyy
  5.  HH:mm:ss 'GMT'");
  6.         }else
  7.             if(datetime.contains("UTC")){
  8.          formatter = DateTimeFormat.forPattern("E MMM dd yyyy
  9. HH:mm:ss 'UTC'");
  10.             }  
  11.         datetime = datetime.split("-")[0];
  12.          logger.info("gmt time from client side:" + datetime + ":");
  13.          DateTime dt = formatter.parseDateTime(datetime);
  14.          Date gmttime = dt.toDate();
  15.          return gmttime;
  16.      }
  17.      
  18. Caused by: java.lang.IllegalArgumentException: Invalid format: "Tue Apr 23 06:44:45 UTC" is malformed at ":44:45 UTC"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top