• 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
Re: daylight saving time problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: daylight saving time problem


  • Subject: Re: daylight saving time problem
  • From: David den Boer <email@hidden>
  • Date: Fri, 26 Jan 2007 19:30:00 -0800

What you have there is fully DST compatible, if you do not use NSTimestamp :-)

That being said, if you avoid using timezones with NSTimestamp, and do not use the time-component constructor :

NSTimestamp(int year, int month, int date, int hour, int minute, int second, TimeZone tz) 


then you are good. If you need that one, then try :

/**
* Creates a new NSTimestamp using the passed in components and timezone info.
*/
public static NSTimestamp timestampForComponents(int iYear, int iMonth, int iDay, int iHours, int iMinutes, int iSeconds, TimeZone iZone) {
GregorianCalendar aCal = new GregorianCalendar(iYear, iMonth, iDay, iHours, iMinutes, iSeconds);
if (iZone != null)
aCal.setTimeZone(iZone);
return new NSTimestamp(aCal.getTime());
}

OR to change timezone on an existing date :


/**
* Returns a new time stamp for the passed in Timezone.
*
* @param iMillis time stamp to be converted
* @param iZone Timzone in which conversion is needed.
* @return an NSTimestamp with date converted to iZone.
*/
public static NSTimestamp changeDateForTimezone(long iMillis, TimeZone iZone) {
long anOffset = 0l;
if (iZone != null)
anOffset = iZone.getOffset(iMillis);
return new NSTimestamp(iMillis + anOffset);
}
public static NSTimestamp changeDateForTimezone(NSTimestamp iTimestamp, TimeZone iZone) {
return changeDateForTimezone(iTimestamp.getTime(), iZone);
}



On Jan 26, 2007, at 2:45 PM, Ken Anderson wrote:

Is there a reasonable solution for this yet?  I'm running java 1.5.0_06, which sun claims is compatible with the new daylight saving time change, but it is not.  How can I get this fixed?  I'm on OS X 10.4.8.

Ken

 _______________________________________________
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: daylight saving time problem
      • From: Jacky Gagnon <email@hidden>
    • Re: daylight saving time problem
      • From: Francis Labrie <email@hidden>
References: 
 >So little time, so many mistakes to be made... (From: Ray Kiddy <email@hidden>)
 >Re: daylight saving time problem (From: Ken Anderson <email@hidden>)

  • Prev by Date: Check this out!
  • Next by Date: Re: daylight saving time problem
  • Previous by thread: Re: daylight saving time problem
  • Next by thread: Re: daylight saving time problem
  • Index(es):
    • Date
    • Thread