title: NSDate to GMTDate to JSON format
body: <p>I want to convert my Local date ([NSDate date]) to GMT to create a JSON string (/Date(1324435876019-0000)/). </p>
  
  <p>My code works fine when i set my clock to EST time zone when i change my timezone to PST my code still acts as EST. Can you please tell me what is the problem is following code?</p>
  
  <pre><code>        NSDate *localDate = [NSDate date];
      NSTimeInterval timeZoneOffset = [[NSTimeZone systemTimeZone] secondsFromGMT]; // You could also use the systemTimeZone method
      NSTimeInterval gmtTimeInterval = [localDate timeIntervalSinceReferenceDate] - timeZoneOffset;
      NSDate *gmtDate = [NSDate dateWithTimeIntervalSinceReferenceDate:gmtTimeInterval];
      NSString *time = [NSString stringWithFormat:@"/Date(%@-0000)/", [NSNumber numberWithLongLong:[gmtDate timeIntervalSince1970] * 1000]];
  </code></pre>