// In the class we defile the select statement that will pull the date in question. in my example im pulling the max Meeting date from a custome object called Governance_Decision__c
try{
tempARObj = [
SELECT MAX(CFARR_Meeting_Date__c) maxMeetingDate FROM Governance_Decision__c WHERE Project_Name__c IN:idSet];
It depends on which timezone you are in - I seem to recall that some calendars start the week on Sunday and some on Monday.
If you are after the day of the week, is there any reason why you wouldn't use the 'EEEE' format?
E.g. in the system log:
Gives the output:
All Answers
If you put your date into a datetime, you can use the format method to generate a string containing the day of the week.
E.g. if you have your date in a variable called theDate:
ok. I tested the following in the system log window:
Datetime dt = DateTime.newInstance(Date.today(), Time.newInstance(0, 0, 0, 0));
String dayOfWeek=dt.format('d');
System.debug('Day : ' + dayOfWeek);
The output value is 2. Does 2 correspond to Monday ?
It depends on which timezone you are in - I seem to recall that some calendars start the week on Sunday and some on Monday.
If you are after the day of the week, is there any reason why you wouldn't use the 'EEEE' format?
E.g. in the system log:
Gives the output:
// In the class we defile the select statement that will pull the date in question. in my example im pulling the max Meeting date from a custome object called Governance_Decision__c
try{
tempARObj = [
SELECT MAX(CFARR_Meeting_Date__c) maxMeetingDate FROM Governance_Decision__c WHERE Project_Name__c IN:idSet];
meetingDate = Date.valueOf(tempARObj.get('maxMeetingDate'));
}
catch(Exception e) {
meetingDate = null;
}
//Ok, so lets display it on the screen. here is the code for the page
<apex:outputText value="{0,date,EEEE DDDD, MMMM, YYYY}"><apex:param value="{!meetingDate}"/></apex:outputText>
//Result: Tuesday, February 05, 2013
I hope this helps
Shawn,