I am using the CFDate* APIs and have a problem with
CFDateFormatterCreateStringWithAbsoluteTime() adding an offset to
my hours.
I want to feed Oct 27, 2005 12:00 PM and get a properly formatted
string for another time zone (so, let's say that time in Paris, ala
CEST timezone, currently at UTC + 2 hours). When I do this I get a
6 hour offset (I'm on the east coast, at UTC - 4 hours, so this
makes sense). Here's what I'm doing:
#1: Create an CFString ("Europe/Paris") and passing that into
CFTimeZoneCreateWithName()
#2: Create a gregorian date with the time I want, and converting to
absolute time, using the Europe/Paris time zone I created in step 1.
#3: Create a CFDateFormatter and using the current locale
#4: ...CreateStringWithAbsoluteTime() with the absolute time I
created in step 2.
When I show the resulting string, it is offset the appropriate
amount taking into account the time zone shift, but I'm not 100%
sure I want this.
Basically: I'm not sure if what I have is a bug ("I didn't specify
my current time zone, why would it take that into account when
doing the to string conversion?") or expected behavior ("Given a
certain time specified, what time is it in Paris right then?").
Maybe I just need to be pointed to the right doc page? (Or maybe I
need to file a bug, I know where that is ;) )
Or, feedback from people more experienced with the CFDate* APIs
could tell me an easier way to do this. That would be cool too ;)
You can set the time zone used with CFDateFormatterSetProperty and
kCFDateFormatterTimeZone. Defaulting to the local time zone seems
reasonable enough.
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden