get Date Stamp - Java java.sql

Java examples for java.sql:Timestamp

Description

get Date Stamp

Demo Code


//package com.java2s;

import java.util.Date;

public class Main {
    public static void main(String[] argv) throws Exception {
        Date date = new Date();
        System.out.println(getDateStamp(date));
    }/*from w ww. ja  va  2  s.c  o m*/

    public static String getDateStamp(Date date) {
        return new java.sql.Timestamp(date.getTime()).toString();
    }
}

Related Tutorials