You need to sign in to do that
Don't have an account?
siva@shiva.com
How to get Month from date field in apex class
just i want to retrive month from dateofbirth field ...please help me
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
just i want to retrive month from dateofbirth field ...please help me
Contact con = [Select Id, BirthDate from Contact where Birthdate != null LIMIT 1];
System.debug(con.BirthDate.Month());
it gives an error ...........
let me clear i want to get records from accountbased on date of birth ,and my vf page contain month pick list .if i select picklist value then display releted records
<apex:page controller="monthtest">
<apex:form >
Select Month <apex:selectList value="{!pickval}" size="1" >
<apex:selectOptions value="{!monthname}" ></apex:selectOptions>
</apex:selectList>
<apex:commandButton value="go" action="{!Go}"/>
</apex:form>
</apex:page>
----------
class
public with sharing class monthtest {
account acc= [Select Id,dob__c from account where dob__c != null LIMIT 1];
System.debug(con.BirthDate.Month());
public PageReference Go() {
return null;
}
public String pickval { get; set; }
public list<selectoption> getmonthname()
{
list<selectoption> month=new list<selectoption>();
month.add(new selectoption('jan','jan'));
month.add(new selectoption('feb','feb'));
return month;
}
}