tm구조체에서요...
글쓴이: samdochen / 작성시간: 화, 2004/04/06 - 5:02오후
void write_date(void) { unsigned long cent,hour,min,sec,year,month,day,week,date,time2,week1; struct tm *tm_ptr, time_struc; time_t the_time; (void) time(&the_time); tm_ptr = localtime(&the_time); time_struc.tm_hour = 12; time_struc.tm_min = 12; time_struc.tm_sec = 12; time_struc.tm_year = 2004; time_struc.tm_mon = 04; time_struc.tm_mday = 06; tm_ptr = &time_struc; the_time = mktime(tm_ptr); stime(&the_time); strftime(buffer, 25, "%Y/%m/%d,%H:%M:%S,%a", tm_ptr); printf("date & time : %s\n",buffer); }
위에서 처럼 tm구조체에 시간, 날짜, 요일을 넣어주는데..
요일을 넣어주지 않아도 맞는 요일이 출력되더라구요..
tm구조체에서는 시간, 날짜만 잘 넣어주면 요일은 저절로 출력이 되는것인지
궁금합니다.
만약 그렇다 하면 추후에 프로그램을 내가 시간, 요일, 날짜를 직접입력하도록 만들었을때 .. 2004년 4월6일은 화요일인데 수요일로 입력하면 수요일로 갱신이 되는지 아님 수요일로 입력해도 출력은 화요일로 되는 것인지. 궁금합니다
Forums:
댓글 달기