Oppure
time_t now; struct tm *timeptr; int anno; now = time(NULL); timeptr = localtime(&now); anno = 1900+timeptr->tm_year; printf("%d\n", anno);