I'm trying to extract the time stated on a cell of a sheets file and use it on a function, but I'm struggling to understand what happens:
On B2, I've simply inputted 05:00 PM
.
Then, on the AppsScript I have:
function myFunction() {
let x=SpreadsheetApp.getActiveSheet().getRange("B2").getValue()
Logger.log(x)
}
And somehow, the output is:
12:46:42 PM Info Sat Dec 30 16:35:55 GMT-00:14 1899
I'm okay with the date (Dec 30th 1899) being something random - after all I've only stated the time, but...
Why am I getting 16:35:55, when I'd be expecting 17:00? where did those 25 minutes go?
How can I get a plain datetime object with time being 17:00
?
Thanks
CodePudding user response:
This appears to be a bug!
There is already a report on Google's Issue Tracker which detail the same kind of behaviour:
Google does seem to know about this issue but you can also hit the ☆ next to the issue number in the top left on the issue report as that lets Google know more people are encountering this and so it is more likely to be seen to faster.