[Last Call] Learn how to a build a cloud-first strategyRegister Now


Convert timestamp into date format Java

Posted on 2009-04-17
Medium Priority
Last Modified: 2012-06-21
I want to change a timestamp value into a date format (yyyy-mm-dd hh:MM:ss).
Please suggest.
Question by:parveendalal
LVL 86

Expert Comment

ID: 24170788

DateFormat df = new SimpleDateFormat("yyyy-mm-dd hh:MM:ss");
String s = df.format(new Date(ts.getTime()));

Open in new window

LVL 92

Accepted Solution

objects earned 1000 total points
ID: 24172376
timastamp is a subclass of Date so you can format it the same way as you would a date


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question