Questions regarding adding time and date to a github Project

Hi there

I’m currently forking a Github project that talks to a Solar inverter with a ESP. My question is how can i get current date or time variable to be sent back to esphome. This is my github GitHub - jeremyoha450/esphome-pipsolar at pip8048

i want to get the date and time and have it send back to ESPhome. For example it has a variable called last_qpigs it send back the last command results. i want to added last_qpigs_time and it will send back the current date or time when the command results were last received. i can add the variable i just dont know how to add the current date or time.

Hoping i explainded it right.

regards