Posts

Showing posts from February, 2017

Schedule Apex Class Job Script

Schedule Apex Class Job Script You Can run you job script in two ways 1 ) From UI : Go to Setup -> Apex Classes -> Click on Schedule Apex button  2) From Developer Console, check below  For Monitor : Go to Setup—>Monitor –> Scheduled Jobs Syntax:  Seconds Minutes Hours Day Month Week Year Year is optional. Seconds                         :- 0–59 Minutes                         :- 0–59 Hours                            :- 0–23 Day (Day_of_month)    :- 1–31 Month                            :- 1–12 Week (Day_of_week)     :- 1–7 Year                             :- null or 1970–2099 The following are some examples of cron expressions: Expression          Description 0 0 14 * * ? Class runs every day at 2 PM. 0 0 20 ? * 6L Class runs the last Friday of every month at 8 PM. 0 0 10 ? * MON-FRI Class runs Monday through Friday at 10 AM. 0 0 20 * * ? 2016 Class runs every day at 8 PM during the year 2016. System.schedule('Job Name ', '0 0

Date Function using in apex

Date Functions are mostly using in apex (Salesforce) addDays(additionalDays) : This function adds the specified number of additional days to a Date. Syntax : public Date addDays(Integer additionalDays) addMonths(additionalMonths) : This function adds the specified number of additional months to a Date . Syntax : public Date addMonths(Integer additionalMonths) addYears(additionalYears) : This function adds the specified number of additional years to a Date . Syntax : public Date addYears(Integer additionalYears) day() : This function returns the day-of-month component of a Date . Syntax : public Integer day() dayOfYear() : This function returns the day-of-year component of a Date . daysBetween(secondDate) : This function returns the number of days between the Date that called the method and the specified date. daysInMonth(year, month) : This function returns the number of days in the month for the specified year and month (1=Jan) . format() : This function r