You need to sign in to do that
Don't have an account?
Standard Datepicker default value
Hi.
I have a VF page that displays two date properties, which can be edited with the standard datepicker. I am setting these properties value to a default date but the when the page loads the text fields linked to them are showing me the dates formatted differently than what the datepicker is expecting (i guess?).
Controller:
public class slotMarcacaoController { public Date startDate { get; set; } public Date endDate { get; set; } public slotMarcacaoController(ApexPages.StandardController controller) { init(); } public slotMarcacaoController (){ init(); } private void init(){ startDate = Date.Today(); endDate = startDate.addDays(7); } public void reserveSlot(Integer index){ } public PageReference refreshSlots(){ //some code return null; } public Datetime lowerLimit {get; set;} public Datetime upperLimit {get; set;} }
VF Page:
<apex:page standardController="Case" extensions="slotMarcacaoController" > <script type="text/javascript"> window.onload=function() { focus('defaultFocus'); } function focus(id){ document.getElementById(id).focus(); } </script> <apex:form > <div> <span id="defaultFocus">Data Inicio</span> <apex:inputText style="position:relative; left:20px;" label="Data Inicio" value="{!startDate}" onfocus="DatePicker.pickDate(true, this, true);" id="date1"> </apex:inputText> </div> <div> <span>Data Fim</span> <apex:inputText style="position:relative; left:28px;" label="Data Fim" value="{!endDate}" onfocus="DatePicker.pickDate(false, this, false);" id="date2"/> </div> <apex:commandButton action="{!refreshSlots}" value="Actualizar"> </apex:commandButton> </apex:form> <apex:outputText value="{!lowerLimit}"></apex:outputText><br/> <apex:outputText value="{!upperLimit}"></apex:outputText> </apex:page>
After the page load the text fields for both dates are in the following format "Fri Feb 08 00:00:00 GMT 2013". When i choose the same date with the datepicker, they show it like "2/8/2013". How can i make it always display the date in the latter format?
Thanks in advance.