do you know of any api in c++ that could give me time in this format:
hh:mm:ss
I used strtime in lccwin32 but it is not compatible with other compilers
Other C compilers use strftime() ...
#include <time.h>
size_t strftime(char *s, size_t maxsize, const char *fmt, const struct tm *t);
... with this as a typical example ...
#include <stdio.h>
#include <time.h>
#include <dos.h>
int main(void)
{
struct tm *time_now;
time_t secs_now;
char str[80];
tzset();
time(&secs_now);
time_now = localtime(&secs_now);
strftime(str, 80,
"It is %M minutes after %I o'clock (%Z) %A, %B %d 19%y",
time_now);
printf("%s\n",str);
return 0;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.