• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Displaying date and time locale specific

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My application is accessed across the globe. I am setting the date and time in java layer and displaying it in JSP. The server is running in US. When ever someone outside US wants to look at the date and time on screen, they will be looking at the US time and date. I want it be locale specific. I guess it should be done at JSP page level. Can you please give inputs on how to implement the date and time for locale specific.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have the link to the JSTL Spec in your sig, the <fmt:formatDate> tag will allow you to specify the time zone to use for emitting the formatted date.

Of course you need to get your users to tell you what time zone they are in. Most sites with registration make this part of the member profile.
[ January 09, 2008: Message edited by: Bear Bibeault ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Bear.

Is it possible to achieve the same using any struts tags.



Of course you need to get your users to tell you what time zone they are in. Most sites with registration make this part of the member profile.



Users will be logging into the application using sso. Can't we just render the page as per user's locale specific time.
 
Bear Bibeault
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vishnu Prakash:
Is it possible to achieve the same using any struts tags.


Not that I'm aware of, but I ditched Struts long ago. So I may not be "in the know" regarding anything that's been added since.

Can't we just render the page as per user's locale specific time.


How would you know what it is? The Date header on a request typically reports the timestamp using GMT.

You could use some JavaScript magic (since the JS runs on the client) to try and figure it out. Perhaps as part of the login, you can have the page add a hidden input that reports the timezone offset? Not something I've done, but it sounds like a good theory/starting point.
[ January 10, 2008: Message edited by: Bear Bibeault ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic