Java Timestamp Convert To toCalendar(final Timestamp ts)

Here you can find the source of toCalendar(final Timestamp ts)

Description

Converts a SQL timestamp into a Calendar .

License

Open Source License

Parameter

Parameter Description
ts Timestamp to convert.

Return

Equivalent calendar.

Declaration

public static Calendar toCalendar(final Timestamp ts) 

Method Source Code


//package com.java2s;
/*/*w  ww  .  jav a  2  s .c  o  m*/
  $Id$
    
  Copyright (C) 2009-2010 Virginia Tech.
  All rights reserved.
    
  SEE LICENSE FOR MORE INFORMATION
    
  Author:  Middleware Services
  Email:   middleware@vt.edu
  Version: $Revision$
  Updated: $Date$
*/

import java.sql.Timestamp;
import java.util.Calendar;

public class Main {
    /**
     * Converts a SQL timestamp into a {@link Calendar}.
     *
     * @param  ts  Timestamp to convert.
     *
     * @return  Equivalent calendar.
     */
    public static Calendar toCalendar(final Timestamp ts) {
        final Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(ts.getTime());
        return cal;
    }
}

Related

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