java - What SimpleDateFormat Pattern to use? -


i receiving date string api in following format: ".expires": "tue, 28 apr 2015 06:17:40 gmt"

now trying pass date variable in java:

public static date getexpiredate(string date) {         if (date != null || (date.length() == 0)) {             //date not null or empty continue             try {                 simpledateformat sdf = new simpledateformat("yyyy-mm-dd hh:mm:ss");                 date datenew = sdf.parse(date);                 return datenew;             }catch(exception e){}         }         // return default timeout                } 

now have found following documentation:

it has simelar example presents pattern like: eee, d mmm yyyy hh:mm:ss z

however time zone says gmt. not gmt -08

what pattern parse string?

this should work:

new simpledateformat("eee',' dd mmm yyyy hh:mm:ss z", locale.us) 

lowercase 'z' general time zone wich pacific standard timeor pst or gmt-08:00