Java TimeZone Add stringToCal(String s, TimeZone tz)

Here you can find the source of stringToCal(String s, TimeZone tz)

Description

string To Cal

License

Open Source License

Declaration

public static Calendar stringToCal(String s, TimeZone tz) 

Method Source Code

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

import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    public static Calendar stringToCal(String s, TimeZone tz) {
        Calendar cal = Calendar.getInstance(tz);
        cal.set(Calendar.MONTH, Integer.parseInt(s.substring(0, 2)) - 1);
        cal.set(Calendar.DATE, Integer.parseInt(s.substring(3, 5)));
        cal.set(Calendar.YEAR, Integer.parseInt(s.substring(6, 10)));
        return cal;
    }//from  www  .  j a v  a 2 s  .  co m
}

Related

  1. isFuture(int month, int year, TimeZone timeZone, Locale locale)
  2. millisFromEpochToHourId(long millis, TimeZone tz)
  3. nowWithTimeZone(TimeZone timezone)
  4. removeTimeZoneOffset(long t)
  5. shiftDate(Date date, TimeZone timeZone, String pattern)
  6. stringToCalendar(String strDate, TimeZone timezone)
  7. toMidnight(long time, TimeZone tz)
  8. tomorrow(TimeZone zone)