0
String dateFormat="Timestamp";
String timeVal ="2015-11-13 05:30:00.0";

return new SimpleDateFormat(dateFormat).format(new Date((((Timestamp) timeVal).getTime())));
1
  • 1
    What kind of date format do you think that is? Commented Oct 12, 2015 at 13:31

1 Answer 1

2

Instead of

String dateFormat="Timestamp";

use

String dateFormat="yyyy-MM-dd HH:mm:ss";

If your date is like

String timeVal ="2015-11-13 05:30:00";

Here you must use date and time format of your date and time.

SimpleDateFormat doc

Sign up to request clarification or add additional context in comments.

2 Comments

hai just i want to convert dateFormat to timestamp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.