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

x
?
Solved

Convert timestamp into date format Java

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

Expert Comment

by:CEHJ
ID: 24170788
Try


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

Open in new window

0
 
LVL 92

Accepted Solution

by:
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

http://helpdesk.objects.com.au/java/how-do-i-format-a-date-as-a-string
0

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