function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sunny670Sunny670 

regarding display of date

Hi All,

i have a requirement like, i have a field which stores monthyear in the format as eg:122009. but i want to display it in my vf page as "Dec2009". I cant change anything in the field now since it is fixed. I want to change it in vf page while diaplaying.can any one please provide me the solution for this.

Best Answer chosen by Admin (Salesforce Developers) 
APathakAPathak

Hi,

I read your last post.

 

Please try like below :-

 

<apex:outputtext value="{!(CASE(left('022013',2),'01','Jan','02','Feb','Invalid'))+right('022013',4)}"/>

 To avoid confusion i have put only Jan & Feb mapping. Please replace the hard coded string '022013' with your variable.

All Answers

kiranmutturukiranmutturu
javascript......

send the value to the script and change the notation..some think like below here it is weekdays you need to change this to months..


&lt;script&gt;
function myFunction()
{
var d = new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";

var x = document.getElementById("demo");
x.innerHTML=weekday[d.getDay()];//here append the year from your input
}
&lt;/script&gt;
Sunny670Sunny670
It does not work in my case since i cannot call java script for <apex:outputText> field. I will post my code. can you tell me why it is throwing error.
<apex:outputtext value="{!(TEXT(baWrap.cbsMap[cbs].monthyear__c.substring(0,2)),'1','Jan','2','Feb','3','Mar','4','Apr','5','May','6','Jun','7','Jul','8','Aug','9','Sep','10','Oct','11','Nov','12','Dec','')}">
</apex:outputtext>
APathakAPathak

Hi,

I read your last post.

 

Please try like below :-

 

<apex:outputtext value="{!(CASE(left('022013',2),'01','Jan','02','Feb','Invalid'))+right('022013',4)}"/>

 To avoid confusion i have put only Jan & Feb mapping. Please replace the hard coded string '022013' with your variable.

This was selected as the best answer
Sunny670Sunny670
Thanks dude. It worked.