Java examples for java.sql:Timestamp
Converts a SQL timestamp into a Calendar .
/*//from w w w .j a v a 2 s . c o m $Id$ Copyright (C) 2008 Virginia Tech, Middleware. All rights reserved. SEE LICENSE FOR MORE INFORMATION Author: Middleware Email: middleware@vt.edu Version: $Revision$ Updated: $Date$ */ //package com.java2s; 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; } }