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
Alexander Svyatetskyi 6Alexander Svyatetskyi 6 

Custom Controller Input Field

Hi, I write custom controller for my custom page. How can I add input datetime field and get value from it (datetime field isn`t SObject Field, it just temp field for computing) ?
ManojSankaranManojSankaran
Hi Alex,

You can make use of <apex:input>

VF Page
<apex:page controller="TestController">
<apex:form>
<apex:input type="date" value="{!StringDate}"/>
<apex:commandButton value="save" action="{!displayDate}"/>
</apex:form>
</apex:page>

Controller
Public class TestController{
    public string StringDate {get;set;}
    
    public void displayDate(){
           date mydate = date.parse('12/27/2009');
     }

}

Let me know if this solves your problem. Mark it as answer if this really solves ur problem.


Thanks
Manoj S