My problem is that dateTimeFormatter doesn't always give the same outcome I expected. Sometimes it returns UTC and sometimes phone's timezone. The method below converts a timestamp to yyMMdd-HHmmss format.
static String convertTimestamp(double timestamp) {
DateTime dateTime = new DateTime((long) timestamp*1000); // conversion to miliseconds
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyMMdd-HHmmss");
return dateTimeFormatter.print(dateTime);
}
I want to get UTC dateTime consistently, how can I achieve this?
Changed return line to this, and now the method returns the proper timestamp everytime.