I am trying to convert a date string in format "yyyyMMddHHmmss" to a date string for another Time Zone "America/Sao_Paulo" taking DST into consideration for America/Sao_Paulo ( which start on 16-oct-2016 ).
I am using TimeZone class as
TimeZone represents a time zone offset, and also figures out daylight savings.
import java.util.TimeZone;
import java.text.*;
import java.util.Date;;
public class TimeZoneConversion {
public static void main(String[] args)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
sdf.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo"));
try
{
String inputdate = "20161016052355";
Date t = sdf.parse(inputdate);
System.out.println(t);
}
catch(ParseException e)
{
}
}
}
Output for the above is shown in IST
Sun Oct 16 12:53:55 IST 2016
How can i convert the the time string with input "yyyyMMddHHmmss" to a time string in "America/Sao_Paulo" Time Zone with DST in output ?