This question appears to be off-topic. The users who voted to close gave this specific reason:

"This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – ændrük, Sneetsher, bain, Eric Carvalho, bodhi.zazen

Please see the documentation of system() function. It returns the exit code of the command (here date) and not the output of it. Also, it would be a bad practice to use a system call in order to take the current second since 1970, but you could use something from time.hstackoverflow.com/questions/2242963/…
–
hakermaniaJun 18 '14 at 16:42

You could directly redirect the output to a file using the redirection operator > as follows:

system("date +\%s > filename");

Remember you need to escape the % and replace filename by the file you want the output to redirect to.

The > operator redirects the output of the command to the left hand side to the file on the right hand side by overwriting the contents of filename (if any) with the output, instead of printing it to standard output. If you want to append the output instead of overwriting the previous contents, you could use >> instead of >.