Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFDateFormatterCreateStringWithAbsoluteTime() and offsets?



On 10/27/05 12:36 PM, Ryan Wilcox didst favor us with:

> 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.

What exactly *do* you want?
> 
> 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 ;) )

As far as I can tell it's doing exactly what you asked. You created a
Gregorian date, converted it to an absolute time telling the system that it
was a Paris time, then displayed the time as a local time.
> 
> Or, feedback from people more experienced with the CFDate* APIs could tell me
> an easier way to do this. That would be cool too ;)

An easier way to do what? Perhaps a specific example of what you're getting
and what you want instead would be helpful?

Larry

 _______________________________________________
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

This email sent to email@hidden

References: 
 >CFDateFormatterCreateStringWithAbsoluteTime() and offsets? (From: Ryan Wilcox <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.