Need help with two errors

It appears that you're attempting to define the getTimeDate function inside of the loop function. You can't do that. You need to move the getTimeDate function definition outside of loop and also specify the return type of void:

void getTimeDate(yearval, monthval, dayval, hourval, minuteval, secondval) {

More information:
http://www.cplusplus.com/doc/tutorial/functions/