Desc :
struct tm *localtime( const time_t *timer );
struct tm 구조체 타입의 주소값을 반환
Source Code :
#include <stdio.h>
#include <time.h>
void main()
{
time_t now;
struct tm t;
time(&now);
t = *localtime(&now); // struct tm 구조체의 포인터의 값을 반환한다.
printf("현재 날짜 및 시간 : %4d년 %d월 %d일 %d:%d:%d\n"
, t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
}
Result :
'C' 카테고리의 다른 글
[C] 171 세계 표준 시 구하기 gmtime() (1) | 2021.02.02 |
---|---|
[C] 170 날짜 및 시간 구하기 _ftime() (1) | 2021.02.02 |
[C] 168 time() 함수 (1) | 2021.02.02 |
[C] 167 표준 입출력 스트림 stdin, stdout (1) | 2021.02.02 |
[C] 166 현재 작업중인 드라이브 변경 _chdrive (1) | 2021.02.02 |