Android Date to UTC Convert getCalendarInUTC(String date)

Here you can find the source of getCalendarInUTC(String date)

Description

get Calendar In UTC

License

Apache License

Declaration

public static Calendar getCalendarInUTC(String date)
            throws ParseException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    public static Calendar getCalendarInUTC(String date)
            throws ParseException {
        Calendar calendar = Calendar.getInstance(TimeZone
                .getTimeZone("UTC"));
        SimpleDateFormat fromDateFormat = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss");
        calendar.setTime(fromDateFormat.parse(date));
        return calendar;
    }/*from w  ww. j  a v a2 s .c o m*/
}

Related

  1. nowUTC()
  2. localDateToUTC(Date dtLocal)
  3. currentDateInUTC()
  4. getDateInUTC(String date)