1

I want to show current month total days on a visualforce page in a table of one coulmn..How can I do that like in below?

1/02/2014,Monday
2/02/2014,Tuesday
3/02/2014,Wednesday
4/02/2014,Thursday
5/02/2014,Firday .
.
.
.
So on upto 30 days

Thanks

| improve this question | | | | |
6

This Apex code will produce the set of dates:

Integer year = 2014;
Integer month = 2;
Date[] dates = new Date[] {};
Integer daysInMonth = Date.daysInMonth(year, month);
for (Integer day = 1; day <= daysInMonth; day++) {
    dates.add(Date.newInstance(year, month, day));
}

and this Visualforce will format those dates:

<apex:pageBlockTable value="{!dates}" var="d">
    <apex:column>
        <apex:outputText value="{0, date, d'/'MM'/'yyyy,EEEE}">
            <apex:param value="{!d}" /> 
        </apex:outputText>
    </apex:column>
</apex:pageBlockTable>
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.