You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Alfors <pe...@irista.com> on 2001/03/08 21:58:11 UTC

user time-zone

It appears that the time-zone offset could be retrieved via javascript
on a startup page, then entered in to the users session through an
action class / hidden field combo.

Its ugly, but it would work.

Any better ideas?


Re: user time-zone

Posted by Peter Alfors <pe...@irista.com>.
I have decided against attempting to display date/times in the user's timezone.
It is not a current client requirement, so I will defer it.

However, I think that you could sufficiently handle the daylight savings issue if
necessary.  So, once you retrieved the user's environment setting for the
timezone, you could display to him/her a more readable date.
If the user has chosen to change the timezone for his computer, or it was set up
wrong, then that would be an issue between him and his IS staff.

Maya Muchnik wrote:

> I have got a response from my colleagues, that the time offset can not be used
> to establish correct time zone. The offset depends on a season and other
> factors. A user can change a time zone through "Date/Time Properties" window
> for NT. It means you need to ask the user what time zone he  / she wants to
> use.
>
> Peter Alfors wrote:
>
> > oops,
> > should be a lowercase 'z'
> >
> > getTimezoneOffset()
> >
> > Peter Alfors wrote:
> >
> > > I have not tried this yet, but according to the books, it should work.
> > >
> > > function getTimeZoneOffset()
> > > {
> > >   var date = new Date();
> > >   var offset = date.getTimeZoneOffset();
> > >   alert(offset);
> > > }
> > >
> > > This is the offset (in minutes) from GMT/UTC.
> > >
> > > HTH,
> > >     Pete
> > >
> > > Maya Muchnik wrote:
> > >
> > > > Please, provide a javascript code how to do this.
> > > >
> > > > Peter Alfors wrote:
> > > >
> > > > > It appears that the time-zone offset could be retrieved via javascript
> > > > > on a startup page, then entered in to the users session through an
> > > > > action class / hidden field combo.
> > > > >
> > > > > Its ugly, but it would work.
> > > > >
> > > > > Any better ideas?

Re: user time-zone

Posted by Maya Muchnik <mm...@pumatech.com>.
I have got a response from my colleagues, that the time offset can not be used
to establish correct time zone. The offset depends on a season and other
factors. A user can change a time zone through "Date/Time Properties" window
for NT. It means you need to ask the user what time zone he  / she wants to
use.

Peter Alfors wrote:

> oops,
> should be a lowercase 'z'
>
> getTimezoneOffset()
>
> Peter Alfors wrote:
>
> > I have not tried this yet, but according to the books, it should work.
> >
> > function getTimeZoneOffset()
> > {
> >   var date = new Date();
> >   var offset = date.getTimeZoneOffset();
> >   alert(offset);
> > }
> >
> > This is the offset (in minutes) from GMT/UTC.
> >
> > HTH,
> >     Pete
> >
> > Maya Muchnik wrote:
> >
> > > Please, provide a javascript code how to do this.
> > >
> > > Peter Alfors wrote:
> > >
> > > > It appears that the time-zone offset could be retrieved via javascript
> > > > on a startup page, then entered in to the users session through an
> > > > action class / hidden field combo.
> > > >
> > > > Its ugly, but it would work.
> > > >
> > > > Any better ideas?


Re: user time-zone

Posted by Peter Alfors <pe...@irista.com>.
oops,
should be a lowercase 'z'

getTimezoneOffset()


Peter Alfors wrote:

> I have not tried this yet, but according to the books, it should work.
>
> function getTimeZoneOffset()
> {
>   var date = new Date();
>   var offset = date.getTimeZoneOffset();
>   alert(offset);
> }
>
> This is the offset (in minutes) from GMT/UTC.
>
> HTH,
>     Pete
>
> Maya Muchnik wrote:
>
> > Please, provide a javascript code how to do this.
> >
> > Peter Alfors wrote:
> >
> > > It appears that the time-zone offset could be retrieved via javascript
> > > on a startup page, then entered in to the users session through an
> > > action class / hidden field combo.
> > >
> > > Its ugly, but it would work.
> > >
> > > Any better ideas?

Re: user time-zone

Posted by Peter Alfors <pe...@irista.com>.
I have not tried this yet, but according to the books, it should work.

function getTimeZoneOffset()
{
  var date = new Date();
  var offset = date.getTimeZoneOffset();
  alert(offset);
}

This is the offset (in minutes) from GMT/UTC.

HTH,
    Pete

Maya Muchnik wrote:

> Please, provide a javascript code how to do this.
>
> Peter Alfors wrote:
>
> > It appears that the time-zone offset could be retrieved via javascript
> > on a startup page, then entered in to the users session through an
> > action class / hidden field combo.
> >
> > Its ugly, but it would work.
> >
> > Any better ideas?

Re: user time-zone

Posted by Maya Muchnik <mm...@pumatech.com>.
Please, provide a javascript code how to do this.

Peter Alfors wrote:

> It appears that the time-zone offset could be retrieved via javascript
> on a startup page, then entered in to the users session through an
> action class / hidden field combo.
>
> Its ugly, but it would work.
>
> Any better ideas?