How to get current UTC or GMT date time in millis in android instead of getting device's current date time : <p>I am trying to get current UTC date time in millis.
But every code I used for this returns me the device's current date time.
When I chenge my device's date, time it shows me chenged one.
So, I want to get GMT/UTC date time so that it will show me correct date even if user changes the date, time of his/her device.</p>

<p>Codes I tried:</p>

<pre><code>Calendar calendar = Calendar.getInstance();
        long now = calendar.getTimeInMillis();
</code></pre>

<p>and</p>

<pre><code>DateFormat df = DateFormat.getTimeInstance();
        df.setTimeZone(TimeZone.getTimeZone("UTC"));
        String gmtTime = df.format(new Date());
        Date gmtDate = df.parse(gmtTime);
</code></pre>

<p>Actually I want to set an alarm at November 15 2017, 5 PM using AlarmManager, receive that event hide some activities in my app which I don't want to show after this date, time.</p>

<p>How can I acheive this?</p>

<p>Thanks in advance!</p>
