Java String to Date stringToDateInTimeZone(String time, String timeZone)

Here you can find the source of stringToDateInTimeZone(String time, String timeZone)

Description

string To Date In Time Zone

License

Open Source License

Declaration

public static Date stringToDateInTimeZone(String time, String timeZone) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static Date stringToDateInTimeZone(String time, String timeZone) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmm");
        dateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
        Date d = null;//  w  ww  .j a  v a2  s  .  com
        try {
            d = dateFormat.parse(time);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return d;
    }
}

Related

  1. stringToDateByconf(String str, String formate)
  2. StringToDateByFormat(String dateStr, String formatStr)
  3. StringToDateByformat1(String time)
  4. stringToDateForIng(String date_str)
  5. StringToDateFormat(String str, String format)
  6. stringToDateMetaData(String dateString)
  7. stringToDateTemporalCoverage(String dateString)
  8. stringToDatetime(String str, String format)
  9. stringToDatetime(String string)