I have a piece of code wriiten in java that gives me the correct time using EST time zone as below:
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class DateProgram {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("EST"));
String dateTime = new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date());
System.out.println(dateTime);
}
}
Here i wanted to add the code for Daylight Saving Time with using EST time zone , my output should give me correct time considering EST time zone and daylight savings also.
Any help Appreciated, Thanks in advance