Google Sheets Date format to timestamp

Hello guys,
I reserched forum and cannot find solution for my problem, so decide to leave the solution for everyone else.

Serial values of dates from google sheets is looks like:

So, it’s just count of days from 30 dec 1899.

To convert unix timestamp you need to do:

function convertDate(d) {
return (d-25568-1)*(24*60*60*1000);

For some reason, I have the difference 3 hours, maybe it’s cause of timezone of google sheets of document. And also I have sometimes difference in 1 second, so add some hardcode like:


I hope, it helps to someone.

1 Like

Welcome to the community @xpacmanx, and thanks for sharing this :heart: