Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can we get current time

 
Ranga Reddy shreya
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we get current time and date on webpage through jsp or html.
Thanks
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JavaScript Date object,
or java.util.Date, and java.text.SimpleDateFormat to create it on server, and send as plain HTML.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will not recommend using javascript date because it depends on client machine.

user time of Web server/Database server
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnaks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic