<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: What time is it in Indiana?</title>
	<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana/</link>
	<description>Comments on Ask MetaFilter post What time is it in Indiana?</description>
	<pubDate>Mon, 04 Jun 2007 12:35:12 -0800</pubDate>
	<lastBuildDate>Mon, 04 Jun 2007 12:35:12 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: What time is it in Indiana?</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana</link>	
		<description>I would like to write a javascript function that takes the current time and adjusts it based on the timezone of any of our customers around the world.  &quot;Easy enough if I know the timezone&quot; I thought......until I started to think about daylight savings time and all of its variations around the world.  What is the best way to tackle this?  Is there a handy script out there to do this, or should I be looking to call a webservice?   I still don&apos;t know what time it is in &lt;a href=&apos;http://www.mccsc.edu/time.html&apos;&gt;Indiana&lt;/a&gt;.  </description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.64071</guid>
		<pubDate>Mon, 04 Jun 2007 12:31:26 -0800</pubDate>
		<dc:creator>jasondigitized</dc:creator>
		
			<category>javascript</category>
		
			<category>dst</category>
		
			<category>time</category>
		
			<category>timezone</category>
		
	</item> <item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963810</link>	
		<description>I&apos;m pretty sure the Javascript Date object pulls the time from users&apos; system clocks, so it should be correct for their timezone as is.&lt;br&gt;
&lt;br&gt;
(I grew up in Indiana, and unless things have changed, they don&apos;t switch for daylight savings.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963810</guid>
		<pubDate>Mon, 04 Jun 2007 12:35:12 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: jasondigitized</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963819</link>	
		<description>I will be performing the calculation on our computers, so the remote system clock cannot  be used.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963819</guid>
		<pubDate>Mon, 04 Jun 2007 12:45:48 -0800</pubDate>
		<dc:creator>jasondigitized</dc:creator>
	</item><item>
		<title>By: myrrh</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963834</link>	
		<description>Javascript, if I&apos;m not mistaken, is a client-side scripting language. Which is to say, you don&apos;t have a choice about where you&apos;re performing the calculation: if the script is on a page being served up in someone&apos;s browser, THEIR computer is executing the script, and THEIR computer is doing the calculation, so it&apos;ll be based on environment variables on their end.&lt;br&gt;
&lt;br&gt;
If you want to do time zone calculation on your end, you&apos;ll have to user a server-side scripting language like perl or PHP.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963834</guid>
		<pubDate>Mon, 04 Jun 2007 12:59:16 -0800</pubDate>
		<dc:creator>myrrh</dc:creator>
	</item><item>
		<title>By: adipocere</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963835</link>	
		<description>I don&apos;t get it.  Javascript is a client-side technology, not server-side.  That&apos;s why it pulls from the users&apos; system clocks, as grumblebee said.  &lt;br&gt;
&lt;br&gt;
Perhaps you want to make a Javascript function that gets the time from the user&apos;s system clock, then reports to you via something Ajaxy?  You could then pull from an environment variable to compare to your local server time.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963835</guid>
		<pubDate>Mon, 04 Jun 2007 13:00:12 -0800</pubDate>
		<dc:creator>adipocere</dc:creator>
	</item><item>
		<title>By: cmm</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963836</link>	
		<description>Things have changed in Indiana. All of the state does DST now, though some parts of the state are central and most of the state is eastern.&lt;br&gt;
&lt;br&gt;
All the systems I&apos;ve done let the user pick the timezone they would like to display their client in. So it doesn&apos;t matter where they are, they can pick whatever they want. The server stores all times in GMT and whenever you pull a time up, right before you display it to the user you convert from GMT to their timezone preference.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963836</guid>
		<pubDate>Mon, 04 Jun 2007 13:00:25 -0800</pubDate>
		<dc:creator>cmm</dc:creator>
	</item><item>
		<title>By: jammnrose</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963837</link>	
		<description>How will the javascript run server-side?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963837</guid>
		<pubDate>Mon, 04 Jun 2007 13:00:33 -0800</pubDate>
		<dc:creator>jammnrose</dc:creator>
	</item><item>
		<title>By: cmm</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963845</link>	
		<description>Javascript is just a programming language. You run it where you want to! Just because it&apos;s best known as &quot;the thing in your web browser&quot; does not make that the only place where javascript is used.&lt;br&gt;
&lt;br&gt;
Java 6 SE even comes with a javascript implementation in it!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963845</guid>
		<pubDate>Mon, 04 Jun 2007 13:04:55 -0800</pubDate>
		<dc:creator>cmm</dc:creator>
	</item><item>
		<title>By: niles</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963853</link>	
		<description>I think &lt;strong&gt;jasondigitized&lt;/strong&gt; means he wants a live listing of client times on his computer. The client never sees it.&lt;br&gt;
&lt;br&gt;
....so when he needs to call up Mr. X in Central Indiana, he knows it might not be a good time because they&apos;re on Moonlight Savings Time, making it 1 AM.&lt;br&gt;
&lt;br&gt;
I think.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963853</guid>
		<pubDate>Mon, 04 Jun 2007 13:14:57 -0800</pubDate>
		<dc:creator>niles</dc:creator>
	</item><item>
		<title>By: chrismear</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963871</link>	
		<description>Handling timezones is a pain in the arse. The pretty-much definitive source for handling timezones programatically is the &lt;a href=&quot;http://www.twinsun.com/tz/tz-link.htm&quot;&gt;tz database&lt;/a&gt;; hopefully there&apos;ll be a library available in whatever environment you&apos;re running this JavaScript that gives access to this database in an easy-to-use fashion.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963871</guid>
		<pubDate>Mon, 04 Jun 2007 13:34:05 -0800</pubDate>
		<dc:creator>chrismear</dc:creator>
	</item><item>
		<title>By: jammnrose</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963873</link>	
		<description>Why not have some javascript run clientside and use an ajax function to send client time then?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963873</guid>
		<pubDate>Mon, 04 Jun 2007 13:35:00 -0800</pubDate>
		<dc:creator>jammnrose</dc:creator>
	</item><item>
		<title>By: cmm</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963908</link>	
		<description>If you&apos;re on a web page, just store offset from GMT with your client and then pass that to the page so it knows how much to offset your current time to make it into client time.&lt;br&gt;
&lt;br&gt;
It&apos;s 5pm in Indiana. I should go home!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963908</guid>
		<pubDate>Mon, 04 Jun 2007 14:00:35 -0800</pubDate>
		<dc:creator>cmm</dc:creator>
	</item><item>
		<title>By: jasondigitized</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963925</link>	
		<description>I understand the javascript is a client-side programming language.  But that does not mean the the client has the right time.  Maybe I should not have put &apos;javascript&apos; in the question.  I am just wondering how people handle this.  For example, FogBugz or Basecamp logs tickets / requests, presumably using the server time as a time stamp.  But the &apos;client&apos; may be in a different time zone, and therefore the ticket / request timestamp needs to be adjusted based on the user&apos;s timezone.  How is this done server side?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963925</guid>
		<pubDate>Mon, 04 Jun 2007 14:21:21 -0800</pubDate>
		<dc:creator>jasondigitized</dc:creator>
	</item><item>
		<title>By: chrismear</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#963934</link>	
		<description>The timestamp is stored in the DB in UTC. Each user has a setting where they can set their timezone. Then, when rendering the page, they use a timezone database/library to convert the UTC time into the appropriate time for the current user&apos;s timezone. In Rails, for instance, you might use the &lt;a href=&quot;http://weblog.jamisbuck.org/2007/2/2/introducing-tztime&quot;&gt;TzTime&lt;/a&gt; plugin.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-963934</guid>
		<pubDate>Mon, 04 Jun 2007 14:24:54 -0800</pubDate>
		<dc:creator>chrismear</dc:creator>
	</item><item>
		<title>By: zengargoyle</title>
		<link>http://ask.metafilter.com/64071/What-time-is-it-in-Indiana#964105</link>	
		<description>&lt;a href=&quot;http://builder.com.com/5100-6370-6016329.html&quot;&gt;This&lt;/a&gt; may help a little bit.  What others have said is correct, &lt;b&gt;always&lt;/b&gt; store UTC time in the database.  You then can convert the UTC timestamp to a clients preferred timezone, &lt;b&gt;or&lt;/b&gt; you could have a little bit of Javascript automagically convert UTC timestamps to the local timezone of the machine.&lt;br&gt;
&lt;br&gt;
So instead of converting &apos;1180999878&apos; (&quot;Mon Jun  4 23:31:18 UTC 2007&quot;) on the server into &quot;Mon Jun  4 16:31:18 PDT 2007&quot; for me, you could instead send something like:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
[script type=&apos;javascript&apos;]&lt;br&gt;
utc2local(&apos;1180999878&apos;);&lt;br&gt;
[/script]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Where the &lt;code&gt;utc2local()&lt;/code&gt; function would convert from UTC to the local timezone and document.write() the timestamp in the local timezone.&lt;br&gt;
&lt;br&gt;
This has the advantage that it works even if the client has not set a timezone preference, it fails when the client would like to see time information in a timezone other than the timezone of the browser/machine (maybe while traveling).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.64071-964105</guid>
		<pubDate>Mon, 04 Jun 2007 16:36:58 -0800</pubDate>
		<dc:creator>zengargoyle</dc:creator>
	</item>
	</channel>
</rss>
