I read a lot of answers to similar questions, but I couldn't find what I intend to do.
I'm developing an android application that I need to check if the current device DateTime (variable TimeZone) are between two DateTimes (specified in UTC+0).
Here a pseudo example:
if( (UTC+0 DateTime of actual week friday at 23:00:00)
<
(device DateTime transformed to UTC+0)
<
(UTC+0 DateTime of actual week sunday at 23:00:00) )
{
#some code here
}
I don't know how to obtain the first and third DateTimes, I can get the day with:
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
if(Calendar.FRIDAY < c.get(Calendar.DAY_OF_WEEK) < Calendar.SUNDAY)
but I still need the DateTime of the actual week friday and sunday at 23:00:00 specified in UTC+0.
I want to transform the actual device DateTime to UTC+0 before the comparision, I tried with Calendar and Joda Time utils but I couldn't find a simple way to obtain the current UTC+0 DateTime and also transform a non UTC+0 DateTime to UTC+0.
I'm sure it must be very simple but can't find the way.