Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Schedule Entry Start/End Date

solonxu
Kilo Expert

Hi, Community,

I am trying to get the   start/end date in current year, for example, I have a schedule set as:

find_real_file.png

If I call schedule_entry.start_date_time, it returns '2014-10-21', which I actually want 2016-10-21.

Does anyone know if there is any oob function I can use to get the updated data? Or I have to calculate through custom script?

Any suggestion would be appreciated.

6 REPLIES 6

dhasselquist
Mega Guru

Solon,



If you want the same date (day and month) but with the current year, I don't know that there is an out of the box function to do that. The only way I'm familiar is with plain javascript.



Using "var gDate = new GlideDate();" for example would return "2016-01-21", the current date. If you wanted to take, say, "2014-04-13" and make it "2016-04-13" that would require some scripting.



Can you explain a little more about what you're trying to do?


Thank you Dylan.



I setup a yearly-repeating schedule entry, like the screenshot I attached. If I submit a form today (created_on: 2016-01-20), I would like to compare this 'Created_on' date with the schedule entry (should be 2016-01-21 in this year). However if I use schedule_entry.start_date_time it returns '2014-01-21".



I am wondering if there is a way I can get this year's date in this schedule without scripting.


I haven't really used schedules much out of the box, so forgive me if I'm misunderstanding.



What I am trying to figure out is why you need to do a comparison on the year of the day specified in the schedule.


OK, for example, we want all ticket with Start Date (u_start_date) in following time window to be marked as 'Emergency':



Dec 25 - Jan 3rd


July 4 - July 7


Sep 1 - Sep 3



System admin (with no scripting knowledge) should have the ability to add/edit time window entry, what would you suggest to do?



Thanks.