Format date for Brazilian format using webservices

0

How to format a date timestamp for timestamp br. ex.

2015-02-03 15:37:00 para 03/02/2015 15:37:00

obs: date is text

    
asked by anonymous 25.04.2016 / 20:40

1 answer

1

One of the forms may be as below:

    String dataUS = "2015-02-03 15:37:00";

    SimpleDateFormat oldFormat =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    SimpleDateFormat newFormat =  new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

    System.out.println(newFormat.format(oldFormat.parse(dataUS)));

That returns:

  

03/02/2015 15:37:00

See working in IDEONE .

    
25.04.2016 / 20:47