User Tools

Site Tools


c:time.h:asctime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:time.h:asctime [2013/01/22 22:02]
c:time.h:asctime [2024/02/16 01:04] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +===== asctime =====
 +   
 +
 +<code c>
 +   char *asctime(const struct tm *timeptr);
 +</code>
 +
 +
 +=== Description ===
 +The function asctime() converts the time in the struct ptr to a character string of the format:
 +Day Month Date Hour:Minute:Second Year\n\0
 +    
 +===== asctime C Sourcecode Example =====
 +<code c>
 +/* 
 + * asctime example code
 + * http://code-reference.com/c/time.h/asctime 
 + */
 +#include <stdio.h>
 +#include <time.h>
 + 
 +int main ( void )
 +{
 +  time_t rawtime;
 +  struct tm * timeinfo;
 + 
 +  time ( &rawtime );
 +  timeinfo = localtime ( &rawtime );
 +  printf ( "Current Date is: %s", asctime (timeinfo) );
 + 
 +  return 0;
 +}
 +</code>
 +
 +==== asctime output ====
 +    Current Date is: Sat Apr 21 13:13:46 2012
 +
 +
 +==== see also ====
 +[[c:time.h:localtime|localtime()]] [[c:time.h:gmtime|gmtime()]] [[c:time.h:time|time()]] [[c:time.h:ctime|ctime()]]
 +
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz