• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display date and time in users Timezone?

 
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic