Program to display AM/PM with Current Time

I'm trying to display the AM/PM on my program:

Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?

#include <iostream>
#include <time.h>
using namespace std;

int main()
time_t tim;
cout << ctime(&tim);

Topic archived. No new replies allowed.