There is an option to write a script and bind it to a trigger. The question is, how to get the current time in the script body?
function myFunction() { var currentTime = // <<??? }
Method 1: Use SPLIT Function On cell B2, type =SPLIT(A2, “ ”). This will automatically write the date in cell B2 and the time in cell C2. Don't forget the space between the “ ”.
use the JavaScript Date()
object. There are a number of ways to get the time, date, timestamps, etc from the object. (Reference)
function myFunction() { var d = new Date(); var timeStamp = d.getTime(); // Number of ms since Jan 1, 1970 // OR: var currentTime = d.toLocaleTimeString(); // "12:35 PM", for instance }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With