0

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

2
Contributors
1
Reply
3
Views
12 Years
Discussion Span
Last Post by vegaseat
0

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;
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.