var cookies = JSON.parse(YOUR_COOKIES);
var url = "facebook.com";
var string = "";
var expDate = 0;
for (var i = 0; i < cookies.length; i++) {
cookie = cookies[i];
if(i === 0) expDate = cookie.expirationDate;
string += cookie.domain + "\t" +
(!cookie.hostOnly).toString().toUpperCase() + "\t" +
cookie.path + "\t" +
cookie.secure.toString().toUpperCase() + "\t" +
(!!cookie.expirationDate ? convert("("+cookie.expirationDate+")") : convert("("+expDate+")")) + "\t" +
cookie.name + "\t" +
cookie.value + "\tTRUE\tFALSE"+((i === cookies.length - 1) ? "" : "\n");
// console.log(!!cookie.expirationDate);
}
function convert(timestamp) {
var date = new Date( // Convert to date
parseInt( // Convert to integer
timestamp.split("(")[1] // Take only the part right of the "("
)*1000
);
return [("0" + (date.getMonth()+1)).slice(-2),("0" + date.getDate()).slice(-2),date.getFullYear()].join('/') + " " + date.toLocaleTimeString();
}