i using retrofit. data (date & time) server. create date (2016-01-22 15:22:37)
. want show date (2016-01-22)
.
user = storeutil.getinstance().selectfrom("users"); networkengine.getinstance().getnotsending(user.getid(), new callback<list<mypending>>() { @override public void success(list<mypending> mypendings, response response) { txt_taker_name.settext(getresources().getstring(r.string.str_taker_name) + ":" + " " + mypendings.get(0).getshippinginformation().getname()); txt_taker_address.settext(getresources().getstring(r.string.str_taker_address) + ":" + " " + mypendings.get(0).getshippinginformation().getaddress()); txt_cargo_name.settext(getresources().getstring(r.string.str_cargo_name) + ":" + " " + mypendings.get(0).getshippingtransactiondetail().get(0).getcargo().getname()); txt_cargo_qty.settext(getresources().getstring(r.string.str_cargo_qty) + ":" + " " + mypendings.get(0).getshippingtransactiondetail().get(0).getcargo().getquantity()); txt_total_weight.settext(getresources().getstring(r.string.str_confirm_totalweight) + ":" + " " + mypendings.get(0).gettotalweight()); txt_total_deliver_charges.settext(getresources().getstring(r.string.str_confirm_totalcharges) + ":" + " " + mypendings.get(0).gettotalcost()); string date = new simpledateformat("yyyy-mm-dd").format( mypendings.get(0).getshippingtransactiondetail().get(0).getcargo().getcreatedat()); txt_deliver_date.settext(getresources().getstring(r.string.str_deliver_date) + ":" + " " + date); } @override public void failure(retrofiterror error) { toast.maketext(getapplicationcontext(), error.getmessage(), toast.length_long).show(); dialog.dismisswithfailure(); } });
simple way split date
string dates = mypendings.get(0).getshippingtransactiondetail().get(0).getcargo().getcreatedat(); if(!dates.equalsignorecase("")){ string date[] = dates.split(" "); log.e("final date-->","-->"+date[0]); }
Comments
Post a Comment