-1
I have a Json output that I am using in a Google Sheets spreadsheet, and with this information I need to sort them by Date, so I need to get this date into the separate Date and Time spreadsheet like this:
Question how to split this date: "2019-07-22T16:00:04.8579075" and turn it into Date & Time as below
Date 22/07/2019
Time 16:00
[
{
ordemChegadaId: 1,
data: "2019-07-22T16:00:04.8579075",
veiculoId: 29,
nome: "J G DO VALE - TRANSPORTES ME"
},
{
ordemChegadaId: 2,
data: "2019-07-22T16:30:02.8375000",
veiculoId: 29,
nome: "AVES - TRANSPORTES ME"
},
. . .
]
Python script responsible for sending information to Google Sheets
function IMPORTJSON(url){
try{
// /rates/EUR
var res = UrlFetchApp.fetch(url);
var content = res.getContentText();
var json = JSON.parse(content);
if(typeof(json) === "undefined")
{
return "Node Not Available";
}
else if(typeof(json) === "object")
{
var tempArr = [];
for(var obj in json)
{
//datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ')
tempArr.push([json[obj].data, json[obj].ordem, json[obj].veiculoId, json[obj].getVeiculo.motorista]);
}
return tempArr;
}
else if(typeof(json) !== "object")
{
return json;
}
}
catch(err){
return "Error getting data";
}
}
You know this script is Javascript, right? I was working out an answer with Python here, the answers that already exist are incomplete, but they are also Python. If you can’t change where you’re using the script, it won’t help.
– jsbueno