Java SQL Date From getDateTime()

Here you can find the source of getDateTime()

Description

get Date Time

License

Apache License

Declaration

public static Timestamp getDateTime() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Timestamp getDateTime() {
        return Timestamp.valueOf(getFormatDate("yyyy-MM-dd HH:mm:ss"));
    }//from   w w w.  ja  va  2s . c om

    public static Timestamp getDateTime(String datetime) {
        return Timestamp.valueOf(datetime);
    }

    protected static String getFormatDate(String formatString) {
        String currentDate = "";
        SimpleDateFormat format1 = new SimpleDateFormat(formatString);
        currentDate = format1.format(new Date());
        return currentDate;
    }
}

Related

  1. getCurrentTimeMillis()
  2. GetCurrFormattedDateTime(String strFormatTo)
  3. getCurrTime()
  4. getCurTime()
  5. getDatabaseLocalTime(Time databaseDate)
  6. getDateTime()
  7. getDateTime()
  8. getDateTime(final int year, final int month, final int day, final int hour, final int minute, final int second)
  9. getDateTime(Object value)