android - GMT date and time to convert Local device Date Time? -
hi got web service result 6/26/2013 12:00:00 gmt how make convert local device time.please give me solution
i have implement code not working
public static string datetime(date date) { simpledateformat dateformat = new simpledateformat("mm/dd/yyyy hh:mm a"); return dateformat.format(date); }
set timezone formatter before parsing date.
public static string datetime(date date) { simpledateformat dateformat = new simpledateformat("mm/dd/yyyy hh:mm a"); timezone tz = timezone.getdefault(); //will return device current time zone dateformat.settimezone(tz); //set time zone simple date formatter return dateformat.format(date); }
Comments
Post a Comment