asctime
raw OCR
Converts date and time to ASCII.
Defined in header <time.h>
Syntax
#include <time.h>
char *asctime(const struct tm *tblock);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
asctime converts a time stored as a structure in *tblock to a 26-character string of the same form as the ctime string:
Sun Sep 16 01:03:52 1973\n\0
Return value
asctime returns a pointer to the character string containing the date and time. This string is a static variable that is overwritten with each call to asctime.
See also
Example
#include <stdio.h>
iinclude <string.h>
#include <time.h>
int main (void)
f
struct tm t;
char str[80];
/* sample loading of tm structure */
t.tm_sec 1; /* Seconds */
t.tm_min = 30; /* Minutes */
t.tm_hour 9; /* Hour V
t.tm_mday ' = 22; /* Day of the Month */
t.tm_mon 11; /* Month */
t.tmj/ear 56; /* Year - does not include century */
t.tm_wday 4; /* Day of the week */
t.tm_yday 0; /* Does not show in asctime */
t.tm_isdst = 0; /* Is Daylight SavTime
Does not show in asctime */
/* converts structure to null terminated string */
strcpy(str, asctime(&tl
printf ("ls\n", str);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/time.h/asctime/
· short form /3.1/asctime/