Java SQL Date Create getCurrDate()

Here you can find the source of getCurrDate()

Description

get Curr Date

License

Open Source License

Return

java.util.Date

Declaration

@SuppressWarnings("finally")
public static Date getCurrDate() 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    @SuppressWarnings("finally")
    public static Date getCurrDate() {
        DateFormat formatter = new SimpleDateFormat("yyyyMMddhhmmssSSS");
        long now = System.currentTimeMillis();
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(now);/* ww w . j av  a  2s . co  m*/
        return calendar.getTime();

    }

    public static String getTime() {
        java.util.Date dt = new java.util.Date();
        java.sql.Timestamp ts = new java.sql.Timestamp(dt.getTime());
        String time = ts.toString();
        return time.substring(0, 19);
    }
}

Related

  1. createStreamingStatement(Connection conn, boolean update)
  2. createUpdateStatement(Connection conn, String databaseName, String[] fieldsToUpdate, String[] selectionFields)
  3. currentDate()
  4. currentDate()
  5. currentDate()
  6. getCurrentDate()
  7. getCurrentDate()
  8. getCurrentDate()
  9. getCurrentDate()