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
Bhaskar@optraBhaskar@optra 

To get Month Number from format like mm/dd/yyyy hh/mm AM/PM

Hi All ,

 

 I have one case field lke the format "mm/dd/yyyy  hh:mm AM/PM"  i.e(3/7/2012 5:07 AM).From this i want to get month value.i.e here 3.How can i get this.

 

 I tried this way

MONTH(DATEVALUE(c.CaseCreated__c)), but it is giving an error "Incorrect parameter for function 'DATEVALUE()'. Expected Text, received java.util.GregorianCalendar".

 

I con't get solution for this.please help.! Any help greatly appreciated:)

mohimohi

Use Date.valueOF(date time) and ther capture month or what you want to get from Date.

Please mark it as accepted if it is a solution.

Bhaskar@optraBhaskar@optra

Hi Mohi,

 

 

Thank you for replying....

 

My problem is:

 

   <apex:column headerValue="Case Number" rendered="{!IF((VALUE(monthval)=MONTH(DateValue(c.CaseCreated__c))),true,false)}">                                                                                                       
<apex:outputField value="{!c.Name}"/>  </apex:column>

 

 for example monthval=march; i.e 3.

   This 3 equals to month value of that date.Then do the operation.

 

My require ment is

 

 In IF condition   (VALUE(monthval)  =  MONTH(DateValue(c.CaseCreated__c)),true,false).

 

The Bold colored function  here is not getting Month value from the DateTime Field.

 

Note:This is in Visual Force page only not in Apex logic.I want to convert it in VF Script and get the Month value.

 

Please help.....waiting for ur reply !:)

 

Thanks

 

 

 

 

 

 

mohimohi

The Month bold letter you have mention works only for Date kind of Data not DateTime.

Did you Check == in place of =