
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_date.htm You can use: Integer currentYear = System.Today ().year (); Let me know if it solved the question.
How to determine your Salesforce release date?
How to Determine Your Salesforce.com Release Dates 1 Find Your Salesforce Instance#N#First you need to determine your Salesforce instance.#N#If you use Salesforce Classic... 2 Find Your Release Schedule More ...
How to know which version of Salesforce spring you are using?
Login to Salesforce Instance --> Go to Home Tab --> If you look at top right side of window, you can see "Spring'17 for Developers label ,which means we are using/in Spring'17 release. NOTE: Hovering over Tab only works in Classic, not in Lightning.
How do I Find my Salesforce Enterprise Edition?
The easiest way is just login in Salesforce and just hover over your Salesforce Tab it will show your Salesforce Edition. 2. Type in company 3. Chose company information I have an org that I am certain I created as a Developer org, but it says Enterprise Edition.
How do I know what Salesforce instance I am on?
First you need to determine your Salesforce instance. If you use Salesforce Classic Interface, login to your Salesforce instance. Then look at the subdomain of the address bar. For example, our Salesforce instance is “NA3.salesforce.com”. This tells me that I am on the NA3 instance.

How do I extract year from date in Salesforce?
If you're using a date field, it would be YEAR(Field__c) . However, if you're using a date/time field, you need to use DATEVALUE (e.g. YEAR(DATEVALUE(Field__c)) . Finally, if you're trying to display it by itself, it needs to be a number return type.
How do I use the date formula in Salesforce?
Use the functions DAY( date ) , MONTH( date ) , and YEAR( date ) to return their numerical values. Replace date with a value of type Date (for example, TODAY() ). To use these functions with Date/Time values, first convert them to a date with the DATEVALUE() function. For example, DAY( DATEVALUE( date/time )) .
How do I find the difference between two dates in Salesforce?
To find the difference between two Date values as a number, subtract one from the other like so: date_1 — date_2 to return the difference in days.
What is the formula for today's date in Salesforce?
When calculating dates using fractions, Salesforce ignores any numbers beyond the decimal. For example: TODAY() + 0.7 is the same as TODAY() + 0 , which is today's date. TODAY() + 1.7 is the same as TODAY() + 1 , which is tomorrow's date.
How do I create a year field in Salesforce?
Unfortunately, there isn't a data type for just year, but there are a few ways to approach this requirement. You could have a date field, where they have to enter a full date and then create a formula field using the YEAR() function to only return the year. Then you can report on that formula field with just the year.
What is the date format in Salesforce?
Date and Time Stored in Salesforce Salesforce uses the ISO8601 format YYYY-MM-DDThh:mm:ss.SZ for date/time fields, which stores date/time in UTC. Assuming a user is in the en-US locale and Pacific time zone, here are two examples for a date field with the value 1965-04-09 .
Can you subtract dates in Salesforce?
Use addition and subtraction operators with date or date/time fields to calculate duration. For example, subtract a date from another date to calculate the number of days between the two. Likewise, you can subtract the date/time from another date/time to get the number of days between the two as a number.
How do I compare two datetime fields in Salesforce?
If you want to compare Date-Times as Dates, just use prevStartDat. Date() and currStartDate. Date() to convert them to Date values.
How can I get current month and year in Apex?
Integer y = Date. Today(). Year();
How are dates stored in Salesforce?
A date is represented as either a Date or Date/Time value. A Date value stores a year, month, and day. A Date/Time value stores a year, month, day, and a time. The time is stored as GMT, but displays in the time zone of the user viewing it.
How do I create a date formula in Salesforce reports?
0:082:58How to Create a Report Formula for Number of Days Between Two DatesYouTubeStart of suggested clipEnd of suggested clipSo create the formula give it whatever name you want so it makes sense based on whatever dates you'MoreSo create the formula give it whatever name you want so it makes sense based on whatever dates you're comparing. And it's going to be a number you're going to throw out a number at the end.
How do I convert date and time to date?
The following formula will help you converting date/time format cell to date only in Excel. 1. Select a blank cell you will place the date value, then enter formula =MONTH(A2) & "/" & DAY(A2) & "/" & YEAR(A2) into the formula bar and press the Enter key.
How to determine if a year is a leap year?
This formula determines whether a year is a leap year. A year is only a leap year if it’s divisible by 400, or if it’s divisible by four but not by 100.
How to find out which quarter a date falls in?
This formula returns the number of the quarter that date falls in (1–4) by dividing the current month by three (the number of months in each quarter) and taking the ceiling.
How to find the day of the week?
To find the day of the week from a Date value, use a known Sunday, for example, January 7, 1900, and subtract it from the date, for example, TODAY (), to get the difference in days. The MOD () function finds the remainder of this result when divided by 7 to give the numerical value of the day of the week between 0 (Sunday) and 6 (Saturday). The formula below finds the result and then returns the text name of that day.
How to find the number of months between two dates?
To find the number of months between two dates, subtract the year of the earlier date from the year of the later date and multiply the difference by 12. Next, subtract the month of the earlier date from the month of the later date, and add that difference to the value of the first set of operations.
How to add days, months, and years to a date?
Add Days, Months, and Years to a Date. If you want to add a certain number of days to a date, add that number to the date directly. For example, to add five days to a date, the formula is date + 5. Adding years to a date is fairly simple, but do check that the future date is valid.
How to calculate how many business days between two dates?
The basic strategy is to choose a reference Monday from the past and find out how many full weeks and any additional portion of a week have passed between the reference date and your date. These values are multiplied by five for a five-day work week, and then the difference between them is taken to calculate business days.
Can you add months to a date?
Adding months to a date is slightly more complicated because months vary in length and the cycle of months restart with each year. So a valid day in one month, January 31, might not be valid in another month, February 31. A simple solution is to approximate each month’s length as 365/12 days:
