Last active
November 14, 2017 19:03
-
-
Save asus4/e3399b50e64f052bb8e0 to your computer and use it in GitHub Desktop.
[google apps script] My spreadsheet snippets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple Check sum | |
* @param {Array} arguments - 1D Array ex [A0:A6] | |
* @return {Number} checksum | |
*/ | |
function CHECK_SUM() { | |
var arr = arguments[0].map(function(v){return v[0]}); | |
var sum = arr.reduce(function(a, b){ return a + b}); | |
return sum & 0xff; | |
} | |
/** | |
* Convert Date to Unix Time | |
* @param {DateTiem} arguments - DateTime object | |
* @return {Number} unixtime | |
*/ | |
function DATE2UNIXTIME() { | |
var dt = arguments[0]; | |
var unixtime = Math.floor(dt.getTime() / 1000); | |
return unixtime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment