Buscar este blog

jueves, 13 de noviembre de 2014

Convertir java.util.date to string


Convertir java.util.date to string:

objElRes.getCampoFecha()!=null){

 Calendar calendar = Calendar.getInstance();

calendar.setTime(objeto.getCampoFecha());   //getCampoFecha es de tipo java.util.date

 SimpleDateFormat format1 = new SimpleDateFormat("dd-MM-yyyy");

String formatted = format1.format(calendar.getTime());

 objeto.setValor(formatted);

No hay comentarios: