# Localized time -- Is there any way I can get the users's time zone?

**URL:** <https://www.ruby-forum.com/t/localized-time-is-there-any-way-i-can-get-the-userss-time-zone/119168>\
**Category:** Rails\
**Created:** [November 4, 2007, 7:34am UTC](https://www.ruby-forum.com/t/localized-time-is-there-any-way-i-can-get-the-userss-time-zone/119168 "2007-11-04T07:34:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnhutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9bcb4/32.png) [@johnhutch](https://www.ruby-forum.com/u/johnhutch)\
**Post date:** [November 4, 2007, 7:34am UTC](https://www.ruby-forum.com/t/localized-time-is-there-any-way-i-can-get-the-userss-time-zone/119168/1 "2007-11-04T07:34:19Z")

</div>

I’m trying to avoid making my users enter a time zone in order to have  
posts and updates displayed in their time. Is there _any_ way I can  
figure out what the user’s current time is so I can add/subtract all  
the times I’m outputting accordingly?

---

<div class="post-metadata">

**Author:** ![johnhutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9bcb4/32.png) [@johnhutch](https://www.ruby-forum.com/u/johnhutch)\
**Post date:** [November 4, 2007, 4:12pm UTC](https://www.ruby-forum.com/t/localized-time-is-there-any-way-i-can-get-the-userss-time-zone/119168/2 "2007-11-04T16:12:58Z")

</div>

On Sun, 04 Nov 2007 06:33:46 +0000, johnhutch wrote:

> I’m trying to avoid making my users enter a time zone in order to have  
> posts and updates displayed in their time. Is there _any_ way I can  
> figure out what the user’s current time is so I can add/subtract all  
> the times I’m outputting accordingly?

You can use JavaScript to pull their timezone information when they  
first  
hit your site. If they’re logging in, then you could just set a hidden  
form field. If there’s no logging in, then you could use a remote form  
call.

Steve

---

<div class="post-metadata">

**Author:** ![johnhutch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9bcb4/32.png) [@johnhutch](https://www.ruby-forum.com/u/johnhutch)\
**Post date:** [November 4, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/localized-time-is-there-any-way-i-can-get-the-userss-time-zone/119168/3 "2007-11-04T18:35:18Z")

</div>

On Nov 4, 7:01 am, Steve [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Steve

take a look at this (one of the more entertainign README’s of this or  
any time)

[http://svn.rubyonrails.org/rails/plugins/tztime/README](http://svn.rubyonrails.org/rails/plugins/tztime/README)
