• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

modifying 'forum time'

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello;
my application runs on a VM with a GMT timezone.
however, it is not the time zone of the users of the application. the zone offset and daylight savings time should be added when message post time is displayed for users (see example of what i mean below).
can this be configured?
please advise on how to approach this issue.
thanks in advance.

example: if the hour is 15:00 and the aplication runs on GMT tome zone.
and my user is on GMT+2 timezone. he posts a new message and looks at the post time. the time will state 15:00 instead of 17:00.

[originally posted on jforum.net by gkatz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the date/time is set using the server configuration. So, if the server is +7 and the user is +2, he will see the date as if it was +7.

But I admit that I'm not giving the appropriated attention to gmt in the current release. For now, I'm affraid you will have to just accept the existing implementation.

To help make it better, please describe how options you think that should be available to date/time configuration and how to you expect them to work, and I assure you that I'll think about it.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wel, go to

src/net/jforum/drivers/generic/PostModel.java
src/net/jforum/drivers/generic/TopicModel.java

If you want to change for users and private messages too, open

src/net/jforum/drivers/generic/PrivateMessageModel.java
src/net/jforum/drivers/generic/UserModel.java

There are methods in those classes which takes a ResultSet as argument and return a filled instance ( so you don't need to replicate the changes over the code ).

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi and thanks;
what i would expect is that end users will see their current time (where they are located) and not the server time. most server are in GMT and most users are not
there are many classes in java,jstl that display a date after calculating time differences.

for the mean while, my current personal use is for people in one timezone (GMT+2) and the server is in GMT.
can you please point me to the code where i the message time is loaded (just before its displayed)?, i can take that time and add the Calendar.ZONE_OFFSET and Calendar.DAYLIGHT_SAVINGS to it and that can to the trick for me (until i go "global").
[originally posted on jforum.net by gkatz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok;
so i changed 2 more places (for & last visit) in the forumAction - a very small change(10 lines tops).
and now my forum is customized for a GMT timezone server and a GMT+2 client.

overall, what i did is:
for posts, just before insert to DB, add the Calendar.ZONE_OFFSET and Calendar.DST_OFFSET of the client TIMEZONE Calendar. and then insert to DB.

for current forum time display, i user a user TIMEZONE specific Calendar (instead of the default)
for last visit, i add the dst & zone offset like for the posts.

Note that this is one approach, the other approach would be storing the posts in server time (like now). and modifying them before display time. personally i think its better like that cause with international forums its best to have everything stored in GMT but this method seemed to me like i would have to change more code in more places.

thanks for your help
[originally posted on jforum.net by gkatz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi rafael;
i decided to insert to the DB the time i needed (instead of post.setTime(new Date() and the same for topic). i modyfied PostAction.insertSave method and it did the trick.

now;
in the forum_list.html there are refrences to ${now} and ${lastVisit}.
where in the code are these attributes being set? i did not understand where these variables come from/

thanks in advance.
[originally posted on jforum.net by gkatz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They come from src/net/jforum/view/forum/ForumAction.java, method list()

Rafael
[originally posted on jforum.net by Rafael Steil]
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic