There is a _tctime function that formats a number into a string of the following format:

day.month.year hours: minutes: seconds

And what function formats in a format

minutes: seconds.

 int tileLeft = 113; TCHAR caption[100] = {}; _tcscpy_s(caption, _tctime(&tileLeft)); caption[_tcslen(caption) - 1U] = TEXT('\0'); 
  • just minutes second? without a year and a month? - KoVadim
  • yes, just minutes and seconds - Anastasiia Melnyk
  • There is a problem - the _tcscpy_s function copies the string, but does not do formatting. Show the full code and a few examples of the input and output you need. - KoVadim
  • one
    / 60 and % 60 ? - vp_arth

1 answer 1

For a more complete setting of the format of a time string, you can use functions of the strftime type. It should be noted that ctime works with time_t ( UNIX time ). And the result is not a time interval , but a point in time from 1970.

If your variable simply contains the number of seconds, and you need to output this value as minutes and seconds - the simplest option is to limit the division, as was already suggested in the comment :

 timeLeft / 60 -> минуты timeLeft % 60 -> секунды