package utils;
import java.util.Calendar;
public class JavaCurrentTimestamp {
/**
* @param args
*/
public static void main(String[] args) {
// create a java calendar instance
Calendar calendar = Calendar.getInstance();
// get a java.util.Date from the calendar instance.
// this date will represent the current instant, or "now".
java.util.Date now = calendar.getTime();
// a java current time (now) instance
java.sql.Timestamp currentTimestamp = new java.sql.Timestamp(now.getTime());
System.out.println("Current Timestamp :"+currentTimestamp);
}
}
/**
####### OUT PUT ###########
Current Timestamp :2010-12-20 12:13:24.164
*/
Sunday, December 19, 2010
Java Current Timestamp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment