Java Timestamp Convert To toCalendar(java.sql.Timestamp stamp)

Here you can find the source of toCalendar(java.sql.Timestamp stamp)

Description

to Calendar

License

Apache License

Declaration

public static java.util.Calendar toCalendar(java.sql.Timestamp stamp) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

import java.util.Locale;
import java.util.TimeZone;

public class Main {
    public static java.util.Calendar toCalendar(java.sql.Timestamp stamp) {
        Calendar cal = Calendar.getInstance();
        if (stamp != null) {
            cal.setTimeInMillis(stamp.getTime());
        }/*  www.ja v a2 s  . c om*/
        return cal;
    }

    /**
     * Returns a Calendar object initialized to the specified date/time, time
     * zone, and locale.
     *
     * @param date
     *            date/time to use
     * @param timeZone
     * @param locale
     * @return Calendar object
     * @see java.util.Calendar
     */
    public static Calendar toCalendar(Date date, TimeZone timeZone, Locale locale) {
        Calendar cal = Calendar.getInstance(timeZone, locale);
        if (date != null) {
            cal.setTime(date);
        }
        return cal;
    }
}

Related

  1. timestampToSearchString(final Timestamp timestamp)
  2. timestampToString(long time)
  3. timestampToTicks(int year, int month, int day, int hours, int minutes, int seconds, int milliseconds)
  4. to_timestamp(String date)
  5. toCalendar(final Timestamp ts)
  6. toCalendar(Timestamp stamp)
  7. toCalendar(Timestamp timestamp)
  8. toDate(java.sql.Timestamp timestamp)
  9. toDate(Timestamp timestamp)