Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Seeing CArray data in watch window Pin
rp_suman9-Apr-08 18:31
rp_suman9-Apr-08 18:31 
GeneralRe: Seeing CArray data in watch window Pin
krmed10-Apr-08 0:52
krmed10-Apr-08 0:52 
GeneralTime format conversion question Pin
monsieur_jj9-Apr-08 16:36
monsieur_jj9-Apr-08 16:36 
GeneralRe: Time format conversion question Pin
Nibu babu thomas9-Apr-08 17:19
Nibu babu thomas9-Apr-08 17:19 
GeneralRe: Time format conversion question [modified] Pin
monsieur_jj9-Apr-08 17:26
monsieur_jj9-Apr-08 17:26 
GeneralRe: Time format conversion question Pin
Antonio29299-Apr-08 23:05
Antonio29299-Apr-08 23:05 
GeneralRe: Time format conversion question Pin
David Crow10-Apr-08 4:55
David Crow10-Apr-08 4:55 
GeneralRe: Time format conversion question Pin
monsieur_jj10-Apr-08 15:29
monsieur_jj10-Apr-08 15:29 
Hi all,

This is what i have done and it works however i am a bit inexperienced and I just want your opinions if and how i can make this better:

<br />
basic_string <char>::size_type indexMonth, indexDays, indexTimeZone, indexYear, indexDate;<br />
		string ArrMonth[] = {" ", "jan ","feb ","mar ","apr ","may ","jun ","jul ","aug ","sep ","oct ","nov ","dec "};<br />
		string ArrDays[] = {" ", "sun ","mon ","tue ","wed ","thu ","fri ","sat "};<br />
		string ArrTimeZone[] = {" ", "atl ","est ","cst ","mst ","pst ","ala ","haw ", "edt ", "cdt ", "mdt ", "pdt "};<br />
		string strDays;<br />
		string strMonth;<br />
		string strTime;<br />
		string strTimeZone;<br />
		string strYear;<br />
		string tempDate;<br />
		tempDate = date;<br />
		int i = 0;<br />
		int j = 0;<br />
		int k = 0;<br />
		int Year = 1950;<br />
<br />
		string lwrFilename;<br />
		char TempStr[500] = {L'\0'};<br />
		strcpy(TempStr, date.c_str());<br />
		lwrFilename = _strlwr(TempStr);	<br />
		date = lwrFilename;<br />
<br />
		do{<br />
			i++;<br />
			indexDays = date.find(ArrDays[i]);<br />
			<br />
		}while ((!(indexDays != string::npos)));<br />
		strDays = ArrDays[i];<br />
<br />
		do{<br />
			j++;<br />
			indexMonth = date.find(ArrMonth[j]);<br />
			<br />
		}while ((!(indexMonth != string::npos)));<br />
		strMonth = ArrMonth[j];<br />
		<br />
		bool timeZone = false;<br />
		do{<br />
			k++;<br />
			indexTimeZone = date.find(ArrTimeZone[k]);<br />
			<br />
		}while ((!(indexTimeZone != string::npos)));<br />
		strTimeZone = ArrTimeZone[k];<br />
<br />
		if(strTimeZone.empty())<br />
		{<br />
			indexTimeZone = date.find("+");<br />
			if ( indexTimeZone != string::npos )<br />
			{<br />
				timeZone = true;<br />
			strTime = date.substr(indexTimeZone, 4);<br />
			}<br />
			else<br />
			{<br />
				indexTimeZone = date.find("-");<br />
				if ( indexTimeZone != string::npos )<br />
				{<br />
					timeZone = true;<br />
				strTime = date.substr(indexTimeZone, 4);<br />
				}<br />
				else<br />
				{<br />
					timeZone = false;<br />
					strTime = "GMT";<br />
				}<br />
<br />
			}<br />
		}<br />
<br />
		indexDate = date.find(":");<br />
		indexDate = indexDate - 2;<br />
		strTime = date.substr(indexDate, 8);<br />
		<br />
		<br />
			stringstream out;<br />
			string tempYear;<br />
		do{<br />
			Year++;<br />
			out<<Year;<br />
			tempYear = out.str();<br />
			out.str("");<br />
			indexYear = date.find(tempYear);<br />
			<br />
		}while ((!(indexYear != string::npos)));<br />
		strYear = date.substr(indexYear, 4);<br />
<br />
		tempDate.replace(indexYear, 4, "    ");<br />
		tempDate.replace(indexDate, 8, "        ");<br />
		if(!timeZone)<br />
		{tempDate.replace(indexTimeZone, 3, "    ");<br />
		}else{<br />
		tempDate.replace(indexTimeZone, 5, "     ");<br />
		}<br />
		tempDate.replace(indexMonth, 4, "    ");<br />
		tempDate.replace(indexDays, 4, "    ");<br />
<br />
		int DateNum;<br />
		DateNum = atoi(tempDate.c_str());<br />
		out<<DateNum;<br />
		tempDate = out.str();<br />
		out.str("");<br />
		string dateFinal;<br />
		<br />
		dateFinal.append(strDays);<br />
		dateFinal.append(", ");<br />
		dateFinal.append(tempDate);<br />
		dateFinal.append(" ");<br />
		dateFinal.append(strMonth);<br />
		dateFinal.append(" ");<br />
		dateFinal.append(strYear);<br />
		dateFinal.append(" ");<br />
		dateFinal.append(strTime);<br />
		dateFinal.append(" ");<br />
		dateFinal.append(strTimeZone);<br />
<br />
		return dateFinal;<br />


Thanks,
Jj
GeneralRe: Time format conversion question Pin
David Crow10-Apr-08 15:40
David Crow10-Apr-08 15:40 
GeneralRe: Time format conversion question [modified] Pin
monsieur_jj10-Apr-08 15:58
monsieur_jj10-Apr-08 15:58 
QuestionRe: Time format conversion question Pin
David Crow11-Apr-08 4:15
David Crow11-Apr-08 4:15 
GeneralRe: Time format conversion question Pin
monsieur_jj13-Apr-08 14:29
monsieur_jj13-Apr-08 14:29 
GeneralRe: Time format conversion question Pin
monsieur_jj13-Apr-08 22:19
monsieur_jj13-Apr-08 22:19 
QuestionRe: Time format conversion question Pin
David Crow14-Apr-08 3:40
David Crow14-Apr-08 3:40 
GeneralRe: Time format conversion question Pin
monsieur_jj14-Apr-08 14:52
monsieur_jj14-Apr-08 14:52 
General3D window update call injection Pin
Fabricio Miranda9-Apr-08 15:33
Fabricio Miranda9-Apr-08 15:33 
GeneralRe: 3D window update call injection Pin
Fabricio Miranda10-Apr-08 2:11
Fabricio Miranda10-Apr-08 2:11 
QuestionLatest version of VC++ & SDK to target Windows 98 and above ? Pin
Defenestration9-Apr-08 13:56
Defenestration9-Apr-08 13:56 
GeneralAudio Signal Processing using Directshow(ISampleGrabber) Pin
Akin Ocal9-Apr-08 12:08
Akin Ocal9-Apr-08 12:08 
GeneralRe: Audio Signal Processing using Directshow(ISampleGrabber) Pin
Mark Salsbery9-Apr-08 12:40
Mark Salsbery9-Apr-08 12:40 
GeneralRe: Audio Signal Processing using Directshow(ISampleGrabber) Pin
Mark Salsbery9-Apr-08 12:56
Mark Salsbery9-Apr-08 12:56 
GeneralRe: Audio Signal Processing using Directshow(ISampleGrabber) Pin
Akin Ocal9-Apr-08 12:58
Akin Ocal9-Apr-08 12:58 
GeneralRe: Audio Signal Processing using Directshow(ISampleGrabber) Pin
Akin Ocal12-Apr-08 11:15
Akin Ocal12-Apr-08 11:15 
GeneralPassing datas from an editbox in the toolbar to the view.cpp Pin
CrocodileBuck9-Apr-08 9:28
CrocodileBuck9-Apr-08 9:28 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
Mark Salsbery9-Apr-08 9:41
Mark Salsbery9-Apr-08 9:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.