Asctime Function

  • It is used for returning a string for tm(structure) in the form of : day month date hours : minutes : seconds year .


  • Syntax:

     char *asctime(const struct tm *ptr);
    
    

    Example:

    
    #include <time.h>
    
      #include <stdio.h>
    
      int main()
    
      {
    
        struct tm *xyz;
    
        time_t l;
    
        l = time(NULL);
    
        xyz = localtime(&l);
    
        printf(asctime(xyz));
    
    
    
        return 0;
    
      }  
    Back