<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: iPhone SDK time bug for international users</title>
	<atom:link href="http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/feed/" rel="self" type="application/rss+xml" />
	<link>http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/</link>
	<description>Explorations in Social Computing</description>
	<lastBuildDate>Fri, 17 Jun 2011 14:33:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: jl75</title>
		<link>http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/comment-page-1/#comment-156</link>
		<dc:creator>jl75</dc:creator>
		<pubDate>Fri, 17 Jun 2011 14:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://multinc.com/?p=183#comment-156</guid>
		<description>Nice catch!

This bug is also present in: &quot;+ (NSString *)time24FromDate:(NSDate *)date withTimeZone:(NSTimeZone *)timeZone&quot;A possible fix is to replace:		if (range.length==0)
			hour += 12;
With:		if (range.length == 0) {//PM

			//12:mm PM should be 12:mm, not 24:mm.

			if (hour != 12) {

				hour += 12;

			}

		}

		else {//AM

			//12:mm AM should be 00:mm, not 12:mm.

			if (hour == 12) {

				hour -= 12;

			}

		}Kind regards,Jan Lubbers</description>
		<content:encoded><![CDATA[<p>Nice catch!</p>
<p>This bug is also present in: &#8220;+ (NSString *)time24FromDate:(NSDate *)date withTimeZone:(NSTimeZone *)timeZone&#8221;A possible fix is to replace:		if (range.length==0)<br />
			hour += 12;<br />
With:		if (range.length == 0) {//PM</p>
<p>			//12:mm PM should be 12:mm, not 24:mm.</p>
<p>			if (hour != 12) {</p>
<p>				hour += 12;</p>
<p>			}</p>
<p>		}</p>
<p>		else {//AM</p>
<p>			//12:mm AM should be 00:mm, not 12:mm.</p>
<p>			if (hour == 12) {</p>
<p>				hour -= 12;</p>
<p>			}</p>
<p>		}Kind regards,Jan Lubbers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jasper Bryant-Greene</title>
		<link>http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/comment-page-1/#comment-132</link>
		<dc:creator>Jasper Bryant-Greene</dc:creator>
		<pubDate>Sun, 04 Jul 2010 11:44:25 +0000</pubDate>
		<guid isPermaLink="false">http://multinc.com/?p=183#comment-132</guid>
		<description>A simpler workaround for date parsing could be:&lt;br&gt;&lt;br&gt;NSString *dateStr = @&quot;2010-07-05&quot;;&lt;br&gt;NSString *timeStr = @&quot;13:30&quot;;&lt;br&gt;&lt;br&gt;NSDateComponents *components = [[NSDateComponents alloc] init];&lt;br&gt;components.year = [[dateStr substringToIndex:4] intValue];&lt;br&gt;components.month = [[dateStr substringWithRange:NSMakeRange(5, 2)] intValue];&lt;br&gt;components.day = [[dateStr substringFromIndex:8] intValue];&lt;br&gt;components.hour = [[timeStr substringToIndex:2] intValue];&lt;br&gt;components.minute = [[timeStr substringFromIndex:3] intValue];&lt;br&gt;&lt;br&gt;NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];&lt;br&gt;&lt;br&gt;NSDate *date = [calendar dateFromComponents:components];&lt;br&gt;&lt;br&gt;[components release];&lt;br&gt;[calendar release];</description>
		<content:encoded><![CDATA[<p>A simpler workaround for date parsing could be:</p>
<p>NSString *dateStr = @&#8221;2010-07-05&#8243;;<br />NSString *timeStr = @&#8221;13:30&#8243;;</p>
<p>NSDateComponents *components = [[NSDateComponents alloc] init];<br />components.year = [[dateStr substringToIndex:4] intValue];<br />components.month = [[dateStr substringWithRange:NSMakeRange(5, 2)] intValue];<br />components.day = [[dateStr substringFromIndex:8] intValue];<br />components.hour = [[timeStr substringToIndex:2] intValue];<br />components.minute = [[timeStr substringFromIndex:3] intValue];</p>
<p>NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];</p>
<p>NSDate *date = [calendar dateFromComponents:components];</p>
<p>[components release];<br />[calendar release];</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Widmer</title>
		<link>http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/comment-page-1/#comment-128</link>
		<dc:creator>Marc Widmer</dc:creator>
		<pubDate>Fri, 19 Feb 2010 05:20:27 +0000</pubDate>
		<guid isPermaLink="false">http://multinc.com/?p=183#comment-128</guid>
		<description>Hello &lt;br&gt;&lt;br&gt;I couldn&#039;t faind any contact-info, so i decided to post here (OT). &lt;br&gt;I&#039;d like to use the WP Plugin Social Privacy with WP(MU) and Buddypress, but it seems not to work with actual versions, are you still developing it ?</description>
		<content:encoded><![CDATA[<p>Hello </p>
<p>I couldn&#39;t faind any contact-info, so i decided to post here (OT). <br />I&#39;d like to use the WP Plugin Social Privacy with WP(MU) and Buddypress, but it seems not to work with actual versions, are you still developing it ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jorge cabezas</title>
		<link>http://multinc.com/2009/09/27/iphone-sdk-time-bug-for-international-users/comment-page-1/#comment-124</link>
		<dc:creator>jorge cabezas</dc:creator>
		<pubDate>Tue, 26 Jan 2010 14:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://multinc.com/?p=183#comment-124</guid>
		<description>Hello,&lt;br&gt;&lt;br&gt;thanks for all your effort. If it helps to anyone, there is still one bug with 12 p.m.  that can be fixed this way:&lt;br&gt;&lt;br&gt;		if (hour &gt; 12) {&lt;br&gt;			result = [dateFormatter dateFromString:[NSString stringWithFormat:@&quot;%02d %02d %02d %02d:%02d p.m.&quot;, year, month, day, hour - 12, minutes]];&lt;br&gt;		} else if(hour == 12){&lt;br&gt;			result = [dateFormatter dateFromString:[NSString stringWithFormat:@&quot;%02d %02d %02d %02d:%02d p.m.&quot;, year, month, day, hour, minutes]];			&lt;br&gt;		} else {&lt;br&gt;			result = [dateFormatter dateFromString:[NSString stringWithFormat:@&quot;%02d %02d %02d %02d:%02d a.m.&quot;, year, month, day, hour, minutes]];&lt;br&gt;		}&lt;br&gt;&lt;br&gt;Best regards,&lt;br&gt;&lt;br&gt;Jorge</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>thanks for all your effort. If it helps to anyone, there is still one bug with 12 p.m.  that can be fixed this way:</p>
<p>		if (hour &gt; 12) {<br />			result = [dateFormatter dateFromString:[NSString stringWithFormat:@"%02d %02d %02d %02d:%02d p.m.", year, month, day, hour - 12, minutes]];<br />		} else if(hour == 12){<br />			result = [dateFormatter dateFromString:[NSString stringWithFormat:@"%02d %02d %02d %02d:%02d p.m.", year, month, day, hour, minutes]];			<br />		} else {<br />			result = [dateFormatter dateFromString:[NSString stringWithFormat:@"%02d %02d %02d %02d:%02d a.m.", year, month, day, hour, minutes]];<br />		}</p>
<p>Best regards,</p>
<p>Jorge</p>
]]></content:encoded>
	</item>
</channel>
</rss>

