Well, that's the approach I'd taken originally, but I found two problems with 
it:

1) I didn't like how that approach mixes the presentation layer into the 
business layer (ie, my data access objects shouldn't care what timezone the 
user is in)

2) I don't necessarily know ahead of time (ie, when fetching the data) what 
timezone the user is in

What I'm aiming for is a solution that does all the timezone manipulation on 
the presentation/view layer so that my business objects don't have to worry 
about it. At least, I think that's what would make the most sense...

Thanks

Ryan Olson

"Hajratwala, Nayan (N.)" <[EMAIL PROTECTED]> wrote:
> I didn't delve too much into the details of your current approach, but 
> couldn't you do this fairly easily using the Calendar class...


>   Date fromDb = ResultSet.getDate(...);
>   Calendar cal = Calendar.getInstance(user's TimeZone, optionally user's 
> Locale);
>   cal.setTime(fromDb);

>   Now you can manipulate/display the values in the user's timezone....

----Original Message-----
From: Ryan Olson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 02, 2002 2:23 PM
To: Struts Users Mailing List
Subject: [slightly OT] Time zone strategies


Hi all,

Although this problem isn't necessarily unique to struts, it's certainly 
something that many of you may have come across in building struts 
applications. I'm writing a CRUD-type app to manage news articles which will 
support users in various time zones. Individual articles have date/time 
stamps which are normalized to the server reference timezone as they are 
stored in the model layer. However, each user should see and modify the dates 
in his/her own timezone on the presentation layer, optionally specifying 
alternate timezones if desired.
[...]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to