Click here to Skip to main content
15,899,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Hi all,

This is what i have done:

string ArrMonth[] = {"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};
		string ArrDays[] = {"sun","mon","tue","wed","thu","fri","sat"};
		string ArrTimeZone[] = {"atl","est","cst","mst","pst","ala","haw", "edt", "cdt", "mdt", "pdt"};
		string strDays, strMonth, strTime, strTimeZone, strYear, tempDate, dateFinal, lwrFilename, tempYear;
		int i = 0, j = 0, k = 0, Year, DateNum;
		stringstream out;
		bool full = false;
		char TempStr[500] = {L'\0'};
		strcpy(TempStr, date.c_str());
		lwrFilename = _strlwr(TempStr);	
		date = lwrFilename;
		size_t foundTime, foundZone;


		std::string strRaw = date; 
		std::string strItem, strTemp; 
		boost::escaped_list_separator<char> esc('\\',' ',':\\'); 
		tokenizer<escaped_list_separator<char>> tok(strRaw,esc);
		for(tokenizer<escaped_list_separator<char>>::iterator beg=tok.begin(); beg!=tok.end();++beg)
		{
			strItem= *beg;
			Year = atoi(strItem.c_str());
			DateNum = atoi(strItem.c_str());
			foundTime=strItem.find(":");
			foundZone=strItem.find("+");
			if(!(strItem.empty())){
				for(i=0; i<12; i++)
				{
					if(i<7){
						if((strItem == ArrDays[i])&&(strDays.empty()))
						{
							strDays = ArrDays[i];
							break;
						}
					}
					if((i<12)&&(strItem == ArrMonth[i])&&(strMonth.empty()))
					{
						strMonth = ArrMonth[i];
						break;
					}
					if(i<11){
						if((strItem == ArrTimeZone[i])&&(strTimeZone.empty()))
						{
							strTimeZone = ArrTimeZone[i];
							break;
						}
					}
					if((foundZone!=string::npos)&&(strTimeZone.empty()))
					{
						strTimeZone = strItem;
						break;
					}
					if((foundTime!=string::npos)&&(strTime.empty()))
					{
						strTime = strItem;
						break;
					}
					if(Year>1980&&(strYear.empty()))
					{
						strYear = strItem;
						break;
					}
					if((DateNum>0) && (DateNum<32) &&(tempDate.empty()))
					{
						tempDate = strItem;
						break;
					}
				}
			}
		}
		
		dateFinal.append(strDays);
		dateFinal.append(", ");
		dateFinal.append(tempDate);
		dateFinal.append(" ");
		dateFinal.append(strMonth);
		dateFinal.append(" ");
		dateFinal.append(strYear);
		dateFinal.append(" ");
		dateFinal.append(strTime);
		dateFinal.append(" ");
		dateFinal.append(strTimeZone);
		return dateFinal;


Do you think this is more efficient?

Thanks,
Jj
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 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
CrocodileBuck9-Apr-08 9:55
CrocodileBuck9-Apr-08 9:55 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
CrocodileBuck9-Apr-08 10:21
CrocodileBuck9-Apr-08 10:21 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
CrocodileBuck9-Apr-08 22:47
CrocodileBuck9-Apr-08 22:47 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
CrocodileBuck10-Apr-08 3:34
CrocodileBuck10-Apr-08 3:34 
GeneralRe: Passing datas from an editbox in the toolbar to the view.cpp Pin
Nelek10-Apr-08 4:49
protectorNelek10-Apr-08 4:49 

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.