Portál AbcLinuxu, 5. listopadu 2025 07:57
// verzia 1
time_t rawtime;
struct tm *info;
char buffer[80];
time(&rawtime);
info = localtime(&rawtime);
strftime(buffer, 80, "%x - %I:%M%p", info);
printf("Formatted date & time : |%s|\n", buffer);
// verzia 2
char buff[20];
time_t now = time(NULL);
strftime(buff, 20, "%Y-%m-%d", localtime(&now));
printf("%s\n", buff);
Chcem vytvorit logovaci subor aby mal v nazve datum a nechapem preco to pada, vdaka.
Řešení dotazu:
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.