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 returns the Date as a string using the locale of the context user .

isLeapYear(year) :
This function returns true if the specified year is a leap year .

isSameDay(dateToCompare) :
This function returns true if the Date that called the method is the same as the specified date .

month() :
This function returns the month component of a Date (1=Jan) .

monthsBetween(secondDate) :
This function returns the number of months between the Date that called the method and the specified date, ignoring the difference in days .

newInstance(year, month, date) :
Constructs a Date from Integer representations of the year, month (1=Jan), and day .

parse(stringDate) :
Constructs a Date from a String. The format of the String depends on the local date format .

today() :
This function returns the current date in the current user's time zone .

toStartOfMonth() :
This function returns the first of the month for the Date that called the method .

toStartOfWeek() :
This function returns the start of the week for the Date that called the method, depending on the context user's locale .

valueOf(stringDate) :
This function returns a Date that contains the value of the specified String .

valueOf(fieldValue) :
Converts the specified object to a Date. Use this method to convert a history tracking field value or an object that represents a Date value .

year() :

This function returns the year component of a Date .

Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page