Java Date Now getCurrentDateTimeObj(String dateTime, String format)

Here you can find the source of getCurrentDateTimeObj(String dateTime, String format)

Description

get Current Date Time Obj

License

LGPL

Declaration

public static Date getCurrentDateTimeObj(String dateTime, String format) throws ParseException 

Method Source Code


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

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

public class Main {

    public static Date getCurrentDateTimeObj(String dateTime) throws ParseException {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.parse(dateTime);
    }//  ww  w  .j av  a2  s. com

    public static Date getCurrentDateTimeObj(String dateTime, String format) throws ParseException {

        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.parse(dateTime);
    }
}

Related

  1. getCurrentDateTime()
  2. getCurrentDateTime(String dateFormat)
  3. getCurrentDateTime(String format)
  4. getCurrentDateTimeForShow()
  5. getCurrentDateTimeISO8601()
  6. getCurrentDateTimeString()
  7. getCurrentDateTimeString(String returnFormat)
  8. getCurrentDateTimeStringValue()
  9. getCurrentDateToString(String pattern)