Time Format
-
Hi, I am getting getting time through CTime::GetCurrentTime() but I am getting time in 24 hours format. How can I change it in 12 hours format?
AFTER getting currenttime you can use Format method for changing time format as you want
-
Hi, I am getting getting time through CTime::GetCurrentTime() but I am getting time in 24 hours format. How can I change it in 12 hours format?
-
Hi, I am getting getting time through CTime::GetCurrentTime() but I am getting time in 24 hours format. How can I change it in 12 hours format?
CTime::GetCurrentTime() returns a CTime object, not a string, so it has not a format. To get the formatted string, have you used the CTime::Format function? Use it with %I instead of %H. P.S.: you cannot read the documentation on MSDN?
-
CTime::GetCurrentTime() returns a CTime object, not a string, so it has not a format. To get the formatted string, have you used the CTime::Format function? Use it with %I instead of %H. P.S.: you cannot read the documentation on MSDN?
-
I am using like
szTimeDisplay.Format(L"%02d:%02d:%0d",tm.GetHour(),tm.GetMinute(),tm.GetSecond());
I also tried as you told but not worked?
-
I am using like
szTimeDisplay.Format(L"%02d:%02d:%0d",tm.GetHour(),tm.GetMinute(),tm.GetSecond());
I also tried as you told but not worked?
use this instead:
szTimeDisplay = tm.Format(_T("%I:%M:%S"))
-
use this instead:
szTimeDisplay = tm.Format(_T("%I:%M:%S"))
-
use %p
szTimeDisplay = tm.Format(_T("%I:%M:%S %p"))