Hopp
Hopp

Reputation: 153

Cron for Start Date and End Date

I just heard about cron expression. So I am totally new in Cron expressions.

My concern is can we use cron expression for start date and end date

suppose I want to start a process on 31th Jan 2017 and end on 2nd Feb 2018.

Is is possible to design cron expression for this condition?

Upvotes: 0

Views: 950

Answers (1)

legacy_shield
legacy_shield

Reputation: 173

Yes definitely you can do. You just need to get the timestamp of the start date and the end date and run your process in between these timestamps. For converting date into timestamps you can use this

{
var myDate="26-02-2012";
myDate=myDate.split("-");
var newDate=myDate[1]+"/"+myDate[0]+"/"+myDate[2];
alert(new Date(newDate).getTime());
}

Upvotes: 0

Related Questions