• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Timezone hell...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timezone hell...


  • Subject: Timezone hell...
  • From: Pascal Robert <email@hidden>
  • Date: Sat, 05 Mar 2011 19:24:30 -0500

Ok, I'm loss here:

    java.util.Calendar now = GregorianCalendar.getInstance(TimeZone.getTimeZone("America/Montreal"));
    NSTimestamp nst = new NSTimestamp(now.getTimeInMillis(), now.getTimeZone());
    NSLog.out.appendln(nst);
    NSLog.out.appendln(nst.getTime());
    NSLog.out.appendln(nst.timeZone().getID());

So, the time coming from java.util.Calendar is 19:16:19, in America/Montreal. That's ok. The problem is with NSTimestamp:

    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - 2011-03-05 19:16:19 Etc/GMT
    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - 1299352579671
    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - Etc/GMT

So the time is 19:16:19 in the NSTimestamp, but the timezone is GMT, so when I display it in America/Montreal, it shows 14:16:19 :-/

According to the JavaDoc:

  NSTimestamp does not maintain time zone information. All NSTimestamps are millisecond offsets since the reference date in the reference time zone. This method assumes time is a time from the tz time zone, and converts time into a time appropriate for NSTimestamp to handle.

Ok, so I guess it's normal that the timezone is GMT, but it should add 5 hours to the time? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Timezone hell...
      • From: George Domurot <email@hidden>
  • Prev by Date: Re: ERModernLook is not the default skin for new D2W project!
  • Next by Date: Re: Timezone hell...
  • Previous by thread: Re: ERModernLook is not the default skin for new D2W project!
  • Next by thread: Re: Timezone hell...
  • Index(es):
    • Date
    • Thread