• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access the server time!!  RSS feed

 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks,
Iam working on a web-based application.How to get the server date and time from my servlet?Please help me out.
Regards,
Ravi
 
Ravi Kumar Ravuru
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dirk Schreckmann,
Can u please elaborate the above said?
Ravi
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running that statement on a system will give you a long that represents the system's time in milliseconds since the beginning of the universe.
Depending what you want to do with the information, you could use it to construct a Date object and a Time object, and then you'd have objects representing the Date and Time of the system that the code were running on.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course a java.util.Date object also includes time information, so you may not need a separate Time object.
Have you figured out what you need. If not, what are you trying to do with the information?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!