Desc :

 

 


Source Code :

#include <stdio.h>
#include <time.h>

void main()
{
	time_t now;
	struct tm t;
	char buff[100],AMPM[10];

	now = time(NULL);
	t = *localtime(&now);
	strftime(buff, sizeof(buff), "%Y-%m-%d %H:%M:%S", &t);
	
	strftime(AMPM, sizeof(AMPM), "%p", &t);
	
	if (strcmp(AMPM, "AM"))	strcpy(AMPM, " 오후");	// 일치하면 0 --> 실행 X
	else strcpy(AMPM, " 오전");

	strcat(buff, AMPM);
	puts(buff);
}

 


Result :

+ Recent posts