In Google Apps Script I have the following:
Date.parse(s2values[k][DOB_COL])
...where s2values[k][DOB_COL]
resolves to a date of birth eg. Sun Jun 02 2013 00:00:00 GMT+0100 (British Summer Time)
In this example, Date.parse returns 1370127600000
which I then use to create an unique ID by adding another value to it.
I want to do the equivalent to Date.parse
in a Google Sheet using formula, rather than in script. I have explored different ways of doing this with TO_DATE and EPOCHTODATE (amongst others) without getting close.
How best to achieve this?
Where G2 = date 02/06/2013 (2nd June 2013)
=VALUE(EPOCHTODATE(TO_DATE(G2),2))
= 25569.00047
=VALUE(TO_DATE(G2))
= 41427
For script Date.parse(date)
= 1370127600000 - this is the expected result.