a post information is
Title - Something
Content - 111
Var(time) - 05:30 AM
2nd post
Title - Something
Content - 222
Var(time) - 05:30 AM
Now if time is 12:00 AM TO 05:30 AM
CHANGE THE FIRST POST CONTENT TO XXX AND 2ND POST CONTENT 111
And if time is 05:30 AM TO 12:00 AM
NO CHANGES FIRST CONTENT IS 111 AND SECOND CONTENT IS 222 Using API Category file
I tried
Code: Select all
var %value1%a = ResultChange("%value3%");
if(%value1%a>0){
document.write("XX");
}
else{
document.write("%value2%");
}
function ResultChange(a){
const aa = a.split(" ");
const aaa = aa[0].split(":");
if(aa[1] =="PM" && aaa[0] !=="12"){
aaa[0] = Number(aaa[0])+12;
}
if(aa[1] =="AM" && aaa[0] =="12"){
aaa[0] = Number(aaa[0])*0;
}
const today = new Date();
const date1 = today.setHours(00, 00, 0);
const date2 = today.setHours(aaa[0], aaa[1], 0);
const diff = date2.valueOf() - date1.valueOf();
const diffInHours = diff/(1000*60);
return diffInHours;
}