public static Timestamp getNow()
{
return new Timestamp(new Date().getTime());
}

解决方案 »

  1.   

    Date today = new Date();
    System.out.println(today);//这个就是今天的时间了
    System.out.println(today.getYear());//这个就是今天的年了
    System.out.println(today.getDate());//这个就是今天的日期了
    ..........
      

  2.   

    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class DateTest{
     public static void main(String[] args){
       Date myDate=new Date(System.currentTimeMillis());
       //This time format is your local time format.
       System.out.println(myDate.toString());
       //Used the simple format to get the String you want .
       //The valid string ,you can reference the JDK Doc
       SimpleDateFormat   sDateFormat=new SimpleDateFormat("yyyy/MM/DD HH:mm:ss");
       System.out.println(sDateFormat.format(myDate));
     }
    }
      

  3.   

    Date date = new Date();
    Timestamp time = new Timestamp(date.getTime());
    System.out.println(time.toString());
      

  4.   

    import java.util.GregorianCalendar;
    {....
    GregorianCalendar d=new Gregorian();
    d.get(Calendar.DAY_OF_WEEK);
    d.get(Calendar.HOUR);}Data 类已经不被1.42推荐
    查阅API便知
      

  5.   

    public class GregorianCalendar
    extends Calendar
    GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar used by most of the world.