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
sp13sp13 

custom date field in visualforce page

i have a visualforce page to search for records whose date is equal to the selected date in visualforce page.
how can i create a custom date field in vf page?

i have an object Schedule__c with a custom DateTime field Date_Time__c

i want to have a date field in the visualforce page to use for searching. is it possible?
Best Answer chosen by sp13
Elie.RodrigueElie.Rodrigue
You need to assign it to a date parameter in your controller : public Date myDate {get;set;} and adding value="{!myDate}"


All Answers

Elie.RodrigueElie.Rodrigue
You can use an apex:input tag with type="date" or type="datetime"
sp13sp13
@Elie: i'm getting this error: 'Error: Unable to validate type 'date': data type not provided'
Elie.RodrigueElie.Rodrigue
You need to assign it to a date parameter in your controller : public Date myDate {get;set;} and adding value="{!myDate}"


This was selected as the best answer
sp13sp13
thanks Elie! :)
S ChowdaryS Chowdary
Hi Eile,

Yhat is working fine and actually i want show today date bydeflut in that filed, So Can you please help on this.
Raghava kolliRaghava kolli
hi...
 take constuctor with respect your controler  and assighn the value to date field
ex: myDate=system.today();.