[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

xcode date formated

Asked by samimi in Ghostscript PDF Software, Objective-C Programming Language, RSS, Apple, Web Languages/Standards

Tags: iphone sdk xcode date

hello every body
i try to make a rss reader in a iphone sdk with xcode and every thing is ok but
i have a rss link i use a parser
and when i print the date of my rss line every time is show in english type

"" show here""

//Paramètres du champ Date
      cell.label2.text = [[monTab objectAtIndex:storyIndex] objectForKey:@"date"];
      cell.label2.font=[UIFont fontWithName:@"Helvetica" size:15.0f];
    return cell;
}



when the parser  the rss feed
i use
cell.label2.text = [[monTab objectAtIndex:storyIndex] objectForKey:@"date"];
and i see

for exemple
fri, 19 jun 2009 12:19:20 gmt

how c an i put this date in french format
vendredi 19 juin 2009

please help me is very urgent

thanks a lot
bertrand samimi
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
//
//  ForumGenViewController.m
//  CameraForum
//
//  Created by CIARLANTI Gregory on 02/06/09.
//  Copyright 2009 e-facto. All rights reserved.
//
 
#import "ForumGenViewController.h"
#import "TableViewCell.h"
#import "PageWeb.h"
 
@implementation ForumGenViewController
 
/**
 * Fonction appelee au chargement de la classe
 *
 */
 
- (void)viewDidLoad 
{
    [super viewDidLoad];
 
	self.title = @"FFB boxe";
	
	if ([monTab count] == 0) //Si le tableau est vide
	{
	//	Path = @"http://ffboxe.com/pages/home/rss.xml.php";
			Path = @"http://www.lemonde.fr/rss/une.xml";
		[self EnXML:Path]; // On appel EnXML et on passe en paramètre "Path"
	}
	
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
 
/**
 * Fonction permettant la convertion d'un flux RSS en donnes XML
 *
 */
 
- (void)EnXML:(NSString *)URL
{
	monTab = [[NSMutableArray alloc] init];
	
	NSURL *xml_URL = [NSURL URLWithString:URL];
	
	RSS_Parser = [[NSXMLParser alloc] initWithContentsOfURL:xml_URL];
	
	[RSS_Parser setDelegate:self];
	
	[RSS_Parser setShouldProcessNamespaces:NO];
	[RSS_Parser setShouldReportNamespacePrefixes:NO];
	[RSS_Parser setShouldResolveExternalEntities:NO];
	
	[RSS_Parser parse];
}
 
- (void)parserDidStartDocument:(NSXMLParser *)parser 
{
	//nslog(@"Fichier trouve, debut de parsing");
}
 
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError 
{
	NSString * errorString = [NSString stringWithFormat:@"Unable to download story feed from web site (Error code %i )", [parseError code]];
	//nslog(@"Erreur de parsing XML: %@", errorString);
	
	UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Erreur de chargement de content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
	[errorAlert show];
}
 
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
	//nslog(@"Element trouve: %@", elementName);
	currentElement = [elementName copy];
	
	if ([elementName isEqualToString:@"item"]) 
	{
		// clear out our story item caches...
		item = [[NSMutableDictionary alloc] init];
		currentTitle = [[NSMutableString alloc] init];
		currentDescription = [[NSMutableString alloc] init];
		currentDate = [[NSMutableString alloc] init];
		//currentSummary = [[NSMutableString alloc] init];
		currentLink = [[NSMutableString alloc] init];
	}
}
 
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
	//nslog(@"Dernier element: %@", elementName);
	if ([elementName isEqualToString:@"item"]) 
	{
		// save values to an item, then store that item into the array...
		[item setObject:currentTitle forKey:@"title"];
		[item setObject:currentLink forKey:@"link"];
		[item setObject:currentDate forKey:@"date"];
		[item setObject:currentDescription forKey:@"description"];
		
		[monTab addObject:[item copy]];
		//nslog(@"Ajout au tableau: %@", currentTitle);
	}
}
 
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
	//nslog(@"found characters: %@", string);
	// save the characters for the current item...
	if ([currentElement isEqualToString:@"title"]) 
	{
		[currentTitle appendString:string];
	} 
	else if ([currentElement isEqualToString:@"link"]) 
	{
		[currentLink appendString:string];
	} 
	else if ([currentElement isEqualToString:@"description"]) 
	{
		[currentDescription appendString:string];
	} 
	else if ([currentElement isEqualToString:@"pubDate"]) 
	{
		[currentDate appendString:string];
	}
}
 
- (void)parserDidEndDocument:(NSXMLParser *)parser 
{
	//nslog(@"Termine!");
	//nslog(@"montab possède %d items", [monTab count]);
	[Tab_ForumGen reloadData];
}
 
- (void)didReceiveMemoryWarning 
{
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
    // Release anything that's not essential, such as cached data
}
 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{
    return 1;
}
 
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return [monTab count];
}
 
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString *CellIdentifier = @"CellIndent";
    
	TableViewCell *cell = (TableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
	{
		UIViewController *c = [[UIViewController alloc] initWithNibName:@"TableViewCell" bundle:nil];
        cell = (TableViewCell *)c.view;
		[c release];
    }
	
	// Paramètres d'une cellule
	int storyIndex = [indexPath indexAtPosition:[indexPath length]-1];
	
	//Paramètres du champ Resume du flux
	
	//nslog(@"Resultat : %@", [[monTab objectAtIndex:storyIndex] objectForKey:@"description"]);
	
	cell.label1.text = [[monTab objectAtIndex:storyIndex] objectForKey:@"title"];
	cell.label1.font=[UIFont fontWithName:@"Helvetica" size:13.0f];
	
	
	
	//Paramètres du champ Date
	cell.label2.text = [[monTab objectAtIndex:storyIndex] objectForKey:@"date"];
	cell.label2.font=[UIFont fontWithName:@"Helvetica" size:15.0f];
    return cell;
}
 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    int storyIndex = [indexPath indexAtPosition:[indexPath length] - 1];
	
	NSString *title=[[monTab objectAtIndex:storyIndex] objectForKey:@"title"];
	NSString *lien=[[monTab objectAtIndex:storyIndex] objectForKey:@"link"];
	NSString *Contenu=[[monTab objectAtIndex:storyIndex] objectForKey:@"description"];
	
	PageWeb *dvController = [[PageWeb alloc] initWithNibName:@"PageWeb" bundle:[NSBundle mainBundle]];
	dvController.lienURL=lien;
	dvController.title=title;
	dvController.Contenu=Contenu;
	
	[self.navigationController pushViewController:dvController animated:YES];
	[dvController release];
	dvController = nil;
}
 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
	return 80.0;
}
 
- (void)dealloc 
{
    [super dealloc];
}
 
/*
 - (id)initWithStyle:(UITableViewStyle)style {
 // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
 if (self = [super initWithStyle:style]) {
 }
 return self;
 }
 */
 
/*
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
*/
/*
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
	[super viewDidDisappear:animated];
}
*/
 
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
 
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/
 
 
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/
 
 
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
 
 
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/
 
@end
[+][-]06/19/09 08:13 PM, ID: 24672009Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06/19/09 08:13 PM, ID: 24672011Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06/21/09 11:44 PM, ID: 24680135Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06/22/09 02:03 AM, ID: 24680659Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625