0
How to convert a 12hr format to 24 hr format using c function.
2 Réponses
+ 3
You first need to know whether it was AM or PM cause it's in 12 hour format. Basically, you add 12 to the hour when it was PM.
Example
02:00 PM in 12 hour format is 14:00 in 24 hpur format. 12 hours was added to the original hour.
+ 3
Durjoy Kumar Saha you can use the function, strftime() and %H format specifier. It requires #include <time.h>.