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
vamsi krishna 106vamsi krishna 106 

Date format changing while page is refreshing

Hi Guys,
I have date field in Vf Like : <apex:inputtext id="implatedDate" size="10" value="{!tissue.implanteddate}"/>
and  this "implanteddate" from Wrapper class. Also i have one command button "Next"
By clicking on Next button my page is refreshing and by that time date format is changing it to different format and showing the below error:
" Value 'Wed Dec 16 00:00:00 GMT 2015' cannot be converted from Text to com.force.swag.soap.DateOnlyWrapper "

​Please update me with your solution.
 
Krishna SambarajuKrishna Sambaraju
Can you share the wrapper class?
vamsi krishna 106vamsi krishna 106
I got ans for the above error but in the VF i am getting new error that is "implanteddate" is unknow property..can u help me..please

Public Date implanteddate;
    Public void setimplanteddate(String implanteddate) {
     this.implanteddate= date.parse(implanteddate);
    }
   public String getimplanteddate() {
       return (implanteddate== null) ? null : implanteddate.format();
    }



 
krprkrpr
post the wrapper class code
Krishna SambarajuKrishna Sambaraju
You need to use get and set to use the property on a visualforce page as below.

Public Date implanteddate {get; set;}
 
vamsi krishna 106vamsi krishna 106
Public Date implanteddate {get; set;}

if i use like this..when my VF page refresh on that time my date format is going to change...
 
<apex:inputtext value={!implanteddate } />
atr there i am using date picker..

please give me some suggestions..
 
Krishna SambarajuKrishna Sambaraju
If you are using jquery datepicker, then declare two variables. One variable as string and another variable as date.

Public string implanteddate {get; set;}
private date myDate;
In your constructor you can format the date you want to populate in the visualforce page input control.
For example : implanteddate = Date.today().format();

And in any of your methods you want it as date then convert it back again to Date as below.
myDate = Date.valueOf(implantedDate);

Hope this helps.

Kind Regards,
Krishna.