I have calendar object created in system timezone which is of "EDT". When ever i get the cal.getTime();
it prints the date of EDT. How can i get the date of the same calendar in UTC?
I am just trying to convert it to string using the below snippet
`Calendar cal = Calendar.getInstance();
String definedDate = CalendarUtils.toString(cal, "MM/dd/yyyy");
System.out.println(definedDate);
public static String toString(Calendar cal, String pattern) {
String str = "";
if (cal!= null) {
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
str = dateFormat.format(cal.getTime());
LOGGER.error("Date : "+str);
}
return str;
}
`