mardi 26 janvier 2016

Showing results between 5 to 14 days from deadline

I am coding some customer service scripts and I would like to make one that displays the results from 5 - 14 days after the deadline.

deadline = 2016-01-20 // so five days after will be 01-25 and 14 will be 02.03 and the results should display it between 5 and 14 days.

I have made an if statement:

if (deadline >= deadline.addDay(5) && deadline <= deadline.addDay(14))
{
print("Ticket ID: " + se.getField(0) + "\n" + "Ticket deadline: " + se.getField(1) + "\n\n");

}

functions addDay - adds a days to the date. getField - gets fields ID and deadline date.

In the results i get also results from 2015. So I assume my logic is wrong. How should I think to make it between 5 days after deadline to 14 days after deadline.

It is not nessesary to give a code example, explanation in what I am doing wrong would be also nice :)

Thank you!

Aucun commentaire:

Enregistrer un commentaire