User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:time.h:asctime

asctime

   char *asctime(const struct tm *timeptr);

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

/* 
 * 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;
}

asctime output

  Current Date is: Sat Apr 21 13:13:46 2012

see also

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/time.h/asctime.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz