Borland C++ reference

ctime

raw OCR

Converts date and time to a string.

Defined in header <time.h>

Syntax

#include <time.h>
char *ctimeCconst timet Hime);

Portability

DOSUNIXWindowsANSI CC++ only
■■■■

Remarks

ctime converts a time value pointed to by time (the value returned by the function time) into a 26-character string in the following form, terminating with a newline character and a null character:

Mon Nov 21 11:31:54 1983\n\0 All the fields have constant width.

Set the global long variable timezone to the difference in seconds between GMT and local standard time (in PST, timezone is 8x60x60). The global variable daylight is nonzero if and only /f the standard U.S. daylight saving time conversion should be applied.

Return value

ctime returns a pointer to the character string containing the date and time. The return value points to static data that is overwritten with each call to ctime.

See also

Example

#include <stdio.h>
#include <time.h>

int main (void)

   time_t t;
   t = time (NULL),•
   printf ("Today's date and time:   %s\n"  ctime(&t
   return 0;
}

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.