Here is the simplest way I getting date I believe -
We just need to query Period Object record and thats it. I think most of us are not aware of this Object in salesforce.com
Date closeDate = [Select EndDate From Period Where type = 'Quarter' and StartDate = THIS_FISCAL_QUARTER].EndDate;
TEXT(MONTH(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(DAY(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(YEAR(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ ' to ' +
TEXT(MONTH((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(DAY((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(YEAR((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
which on today's date (02/14/2013), would return:
2/10/2013 to 2/17/2013
I utilized the formula provided in this post to get the current offset on the day of the week. Using that, I just subtracted from today. Unfortunately, you wanted the date formatted outside of the base format of a date which would be 2013-02-14
. To take account for that, I had to do some manipulation and just pull in the month, day, and year of the date.
Best Answer
I don't think there is direct way. But you can do this.
It will return the start of the week for the Date that called the method, depending on the context user's locale. example, the start of a week is Sunday in the United States locale, and Monday in European locales.