File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display date and time in users Timezone?

 
hasan khan
Ranch Hand
Posts: 222
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i display date and time to the user in his timezone and locale.
if possible please provide an example. thanks in advance.
 
Abhinay Verma
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use DateFormat class. Refer to the Code below


This code gave the following output
13 April 2005 16:53:46 GMT+05:30 //Locale was UK
April 13, 2005 4:54:56 PM GMT+05:30 //Locale was US
13 aprile 2005 16.56.29 GMT+05:30 //Locale was ITALY
13 avril 2005 16:59:55 GMT+05:30 //Locale was FRENCH

Hope this helps.
 
hasan khan
Ranch Hand
Posts: 222
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Abhinay,
my question was "how display date and time to the user in his timezone and locale."

and i got the answer for locale but not for timezone.

for e.g.

my web server is in india. right now time is 17:00.
if some one from UK visit my site he should not get 17:00 in his browser but he should get (17 - 4.30) i.e 12:30

please help
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic