c lenguaje de demostración strftime

formato de fecha time.h

tiempo () Obtiene segunda fecha actual, hora local () para obtener el campo de la hora actual, con formato strftime cadena hasta la fecha

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <pthread.h> 
#include <time.h> 


int main () { 
    time_t rawtime; 
    struct tm * timeInfo = NULL; 
    Char buff [80]; 

    tiempo (y rawtime); 
    printf ( "rawtime:% d \ n", rawtime); 
    timeInfo = localtime (y rawtime); 
    strftime (piel de ante, sizeof (piel de ante), "% Y-% m-% d% H:% M:% S", timeInfo); 
    printf ( "piel de ante:% s \ n", piel de ante); 

    return 0; 
}

  

 

Supongo que te gusta

Origin www.cnblogs.com/luckygxf/p/12508201.html
Recomendado
Clasificación