• 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

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: 67746
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: 67746
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 ]
 
Evildoers! Eat my justice! And this tiny ad's justice too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic