I have a text file which consists of many lines of date, time and other information which is coming from production line.
Problem is that I have a this kind of text file
__7/9/03, 12:13:32 AM, etc......
I'm parsing this file so that it has a finnish date and time like:
7.9.2003 00:13:32, etc....
It's working allmost perfectly but when I do an if statements like:
if (strcmp(ampm, "AM") && hour == 12)
{
outputFile << "00" << ":" << minutes << ":" << seconds << endl;
}
else if (strcmp(ampm,"AM") && hour < 12)
{
outputFile << hour << ":" << minutes << ":" << seconds << endl;
}
else if (strcmp(ampm,"PM") && hour < 12)
{
hour = (hour + 12);
outputFile << hour << ":" << minutes << ":" << seconds << endl;
}
else if (strcmp(ampm,"PM") && hour == 12)
{
outputFile << hour << ":" << minutes << ":" << seconds << endl;
}
So the PM thing works correctly example: if time is 3:23:03 PM it's 14:23:03 in finnish time.. But the AM thing for anything that begins 12:**:** won't work.. It only put's same time to outputFile..
Any suggestions how to do that?
And Thanks in advance!