Bash shell script- help

I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out?

Well, any shell script can ssh. Whose time for what -- Just logging what time is the date command. Any errors covers a lot of territory in even the simplest app. With ssh, your shell script here is feeding a shell there, might be bash, or not. Run this to see:

ssh id@host 'ps -fp $$'