aspose file tools*
The moose likes Servlets and the fly likes How to display the time in miliseconds in a proper format in a JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to display the time in miliseconds in a proper format in a JSP Page" Watch "How to display the time in miliseconds in a proper format in a JSP Page" New topic
Author

How to display the time in miliseconds in a proper format in a JSP Page

Amit Roy
Ranch Hand

Joined: Oct 10, 2000
Posts: 132
Hello
I want to display the time returned by the lastModified() method in the File class in a JSP page in a proper format but as it is returning me a time in milisecs it is useless is ther any methos which will take in time in miliseconds and return me time in a priper format
thanks in Advance
Amit Roy


<I>Chance Favours the Prepared minds"</I>
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
hi amit,
try
java.util.Calendar;
Calendar defines lots of constants to get
the different components of time(year/month etc)
Calendar c = Calendar.getInstance();;
c.setTime(long milliseconds);
then u can do a
c.get(Calendar.YEAR)..and so on.
hope it helps.
karthik
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Or look up java.text.SimpleDateFormat which allows you to format the input and output of dates and times in almost any way you like.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
jQuery in Action, 2nd edition
 
subject: How to display the time in miliseconds in a proper format in a JSP Page