File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How can we get current time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How can we get current time" Watch "How can we get current time" New topic
Author

How can we get current time

Ranga Reddy shreya
Ranch Hand

Joined: Oct 20, 2004
Posts: 30
How can we get current time and date on webpage through jsp or html.
Thanks


Enjoy life .
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Use JavaScript Date object,
or java.util.Date, and java.text.SimpleDateFormat to create it on server, and send as plain HTML.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

I will not recommend using javascript date because it depends on client machine.

user time of Web server/Database server


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi,
I think it is better to get value of current time from server's current time.
You can get using GregorianCalendar or System.currentTimeMillis...

Hope this helps...

thanks
daniel
Ranga Reddy shreya
Ranch Hand

Joined: Oct 20, 2004
Posts: 30
thnaks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can we get current time