BrittonPurin
6 years agoQrew Member
How to Work with Date/Time to create days until
Good Morning. I am building an app and having trouble with the Date/Time format while trying to make a display of when assignments are coming up or past due. I have the formula below but the first line runs into an error because it says the operator "-" can't be applied on types date, datetime. I was able to use it when it is just the date but when I included the time it wouldn't work. I need the time to be able to add it to calendars and other reports. Please let me know if there is a solution. Thank you!
var number numberdays = ToDays(Today()-[Due (Date/Time)]);
var date Estimate = [Due (Date/Time];
var text red = "<a style=\" text-decoration: none; background: #ea4335; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&ToDays(Today()-$Estimate)&" Days Overdue</a>";
var text green = "<a style=\" text-decoration: none; background: #34a853; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&$numberdays&" Days Due</a>";
var text yellow = "<a style=\" text-decoration: none; background: #fbbc05; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&ToDays(Today()-$Estimate)&" Days Due</a>";
var text gray = "<a style=\" text-decoration: none; background: #c2c2c2; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">Completed</a>";
(If(ToDays([Due (Date/Time]-Today())>5,$green,
(If(ToDays([Due (Date/Time]-Today())>0,$yellow,
(If(ToDays([Due (Date/Time]-Today())<=0,$red))))))
------------------------------
Britton Purin
------------------------------
var number numberdays = ToDays(Today()-[Due (Date/Time)]);
var date Estimate = [Due (Date/Time];
var text red = "<a style=\" text-decoration: none; background: #ea4335; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&ToDays(Today()-$Estimate)&" Days Overdue</a>";
var text green = "<a style=\" text-decoration: none; background: #34a853; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&$numberdays&" Days Due</a>";
var text yellow = "<a style=\" text-decoration: none; background: #fbbc05; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">"&ToDays(Today()-$Estimate)&" Days Due</a>";
var text gray = "<a style=\" text-decoration: none; background: #c2c2c2; border-radius: 5px; color: #fff; display: inline-block; width: 160px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-serif; text-shadow: none; \">Completed</a>";
(If(ToDays([Due (Date/Time]-Today())>5,$green,
(If(ToDays([Due (Date/Time]-Today())>0,$yellow,
(If(ToDays([Due (Date/Time]-Today())<=0,$red))))))
------------------------------
Britton Purin
------------------------------