Here you can find the source of format(String time)
public static String format(String time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { private static SimpleDateFormat parser = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); private static SimpleDateFormat formatter = new SimpleDateFormat( "dd-MM-yyyy HH:mm", Locale.getDefault()); public static String format(String time) { try {//from w w w . jav a 2 s.c om // Fix for the database timezone to Brazilian timezone. Calendar calendar = Calendar.getInstance(); calendar.setTime(parser.parse(time)); calendar.add(Calendar.HOUR, 3); return formatter.format(calendar.getTime()) .replaceAll("-", "/"); } catch (ParseException e) { e.printStackTrace(); } return ""; } }