title: Why is the ColdFusion epoch time one hour behind the javascript epoch time?
body: <p>I am writing an application where I need to get the epoch time on the server side using ColdFusion 8 running on Windows Server 2008 and client side using javascript (testing in Google Chrome). The problem is that the epoch time generated by ColdFusion is one hour behind the one generated by javascript. I have verified that the date/time settings are correct both client side and server side.</p>
  
  <p>This is how I am setting the time stamp with ColdFusion:</p>
  
  <pre><code>&lt;cfset cfEpoch = DateDiff("s", "January 1 1970 00:00", DateConvert("Local2utc", now()))&gt;
  </code></pre>
  
  <p>And this is how I'm setting it with javascript:</p>
  
  <pre><code>var jsEpoch = Math.round(new Date().getTime()/1000.0);
  </code></pre>
  
  <p>The javascript epoch matches the one on this website (<a href="http://www.epochconverter.com/" rel="noreferrer">http://www.epochconverter.com/</a>) which makes sense because they're using the same method I'm using. The ColdFusion epoch is one hour behind. Here's what I've run to try to sort this out:</p>
  
  <pre><code>&lt;cfset localDate = now()&gt;
  &lt;cfset utcDate = DateConvert("Local2utc", localDate)&gt;
  &lt;cfset epoch = DateDiff("s", "January 1 1970 00:00", utcDate)&gt;
  
  &lt;cfoutput&gt;
      Local Date: #localDate# &lt;br&gt;
      UTC Date: #utcDate# &lt;br&gt;
      Epoch: #epoch#
  &lt;/cfoutput&gt;
  </code></pre>
  
  <p>That code outputs:</p>
  
  <pre><code>Local Date: {ts '2013-04-30 17:44:56'} 
  UTC Date: {ts '2013-04-30 21:44:56'} 
  Epoch: 1367354696
  </code></pre>
  
  <p>So I'm at a loss. Both the local date and UTC date values are correct. It appears that the only explanation is that the DateDiff() function isn't working properly, but I've tested it with other dates and it seems to work fine. I suppose I can just add 3600 to the epoch value it generates but I'd rather not do that without knowing why I'm getting an incorrect value in the first place. Does anyone see what I'm missing here?</p>