_strtime, _wstrtime

From RAD Studio
Jump to: navigation, search

Go Up to time.h Index


Header File

time.h

Category

Time and Date Routines

Prototype

char *_strtime(char *buf);

wchar_t *_wstrtime(wchar_t *buf);

Description

Converts current time to string.

_strtime converts the current time to a string, storing the string in the buffer buf. The buffer must be at least 9 characters long.

The string has the following form:

HH:MM:SS

where HH, MM, and SS are all two-digit numbers representing the hour, minute, and second, respectively. The string is terminated by a null character.

Return Value

_strtime returns buf, the address of the time string.

Example

#include <time.h>
#include <stdio.h>
void main(void)
{
  char datebuf[9];
  char timebuf[9];
  _strdate(datebuf);
  _strtime(timebuf);
  printf("Date: %s  Time: %s\n",datebuf,timebuf);
}

Portability

POSIX Win32 ANSI C ANSI C++

_strtime

+

_wstrtime

+