Here you can find the source of toTimestamp(final Calendar cal)
Parameter | Description |
---|---|
cal | Calendar to convert. |
public static Timestamp toTimestamp(final Calendar cal)
//package com.java2s; /*//from w w w . ja v a2s . 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 {@link Calendar} into a SQL timestamp. * * @param cal Calendar to convert. * * @return Equivalent timestamp. */ public static Timestamp toTimestamp(final Calendar cal) { final Timestamp ts = new Timestamp(cal.getTimeInMillis()); return ts; } }