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
MALLAREDDY YERRAMREDDY 4MALLAREDDY YERRAMREDDY 4 

I want to set a defalut time(00.30 amto 11.30pm) values a picklist field in VF page.. Please suggest how to acheive?

vinita kumari 8vinita kumari 8
Hi,

There is no standard method to acheive it, So you need to create and custom picklist.
 
Class:
public List<SelectOption> gettimevalue() {
    List<SelectOption> options = new List<SelectOption>();
    DateTime dt = DateTime.newInstance(2000, 1, 1, 0, 0, 0);
    integer i =1;
    List<String> timelist = new List<String>();
    while(i < 48){
       dt = dt.addminutes(30);
       options.add(new SelectOption('dt.format().substringAfter(' ')','dt.format().substringAfter(' ')'));
       i++; 
    }
}

On VF Page:
<apex:selectOptions value="{!timevalue}"/>

The above code will help you acheive the picklist value a/c to your requirement.