Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/03/2011, 10:15
soup
 
Fecha de Ingreso: noviembre-2010
Mensajes: 3
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Fecha de sistema a enteros

Prueba con esto:

Código C++:
Ver original
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int main()
  5. {
  6.     time_t tiempo = time(0);
  7.     struct tm *tlocal = localtime(&tiempo);
  8.     printf("La fecha actual es: %i/%i/%i %i:%i:%i hrs\n"
  9.         , tlocal->tm_mday, tlocal->tm_mon+1, tlocal->tm_year+1900
  10.         , tlocal->tm_hour, tlocal->tm_min, tlocal->tm_sec);
  11.     return 0;
  12. }

Para guardar el año en un entero es muy fácil, solo hay que hacer: int entero = tlocal->tm_year + 1900;.