you can try 
sscanf( day_buffer, "%4d%2d%2d", &years, &monthes, &days );