Sydney,

I don't know if it's the best approach or not, but keep all dates and
times in GMT on the server side. I simply add or subtract the local
offset on the client. In places where the user enters a date/time, I
offset it to GMT before passing it to the server. The conversion is
very fast and I never have to worry about any conversions on the
server side. I do the conversion on the client only when I want to
show it in the local time zone (which is all the time at this point).
For reports/exports, I let the user choose to export the data in their
local time or GMT.

HTH,
Chad
www.milamade.com

On Dec 14, 7:47 pm, Sydney <sydney.henr...@gmail.com> wrote:
> Well not much response on that topic, so let me explain in a better way my
> problem. I have the class Facility in shared folder (client and server).
>
> public class Facility {
>   private List<Log> logs;
>   // getter, setter
>
> }
>
> public class Log {
>   private Date date;
>   // getter, setter
>
> }
>
> I would like to run this method server side. Right now it does not take
> account for locale and is a method of Facility:
>
> public Map<String, Integer> countAccess() {
>   SimpleDateFormat smf = new SimpleDateFormat("M");
>   Map<String, Integer> mapAccess = new HashMap<String, Integer>();
>   for(Log log: logs) {
>     String currentMonth = smf.format(log.getDate());
>     Integer count = mapAccess.get(currentMonth);
>     if(count == null) {
>       count = 1;
>     }
>     mapAccess.put(currentMonth, count);
>   }
>   return mapAccess;
>
> }
>
> The facility has been accessed only once on 12/01/10 at 1:30 GMT, several
> users would have different report:
> locale en-US: November 1, December 0
> locale fr-FR: Novembre 0, Decembre 1
>
> 1/ I understand that to use this algorithm it needs to be executed on the
> server side, but the method is part of an object Facility that can be shared
> client and server side. Where should I put this method to be able to run it
> on the server side? Also this version does not use any locale, so how can I
> get the client locale?
>
> 2/ Another solution is to return the list of date and run the algorithm on
> the client side by using DateTimeFormat but I am wondering if it's a good
> solution since you have to send a lot of data over the wire.
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to