• anupama.aj21.3944428619426914E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I have a requirement where i need to get the date from the datepicker field and convert that into standart GMT format (yyyy-MM-ddTHH:mm:ss.SSSZ).

how do I get the value of the selected date from the datepicker field?
below is my code .

VF Page :
-----------
<apex:page controller="datePicker1" id="mypage">
    <apex:form >  
        Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />  
        <apex:commandButton action="{!displayDate}" value="dispdate" />
        {!outputdate}
    </apex:form>
</apex:page>

APEX Code :
-------------------------

public class datePicker1
{

    public String outputdate { get; set; }
     public datetime datename {get; set;}
    
     public void displayDate()
     {
        
         String formattedDate = datename.format('yyyy-mm-dd');
         outputdate = formattedDate;
        
    }
}

This code is not displaying any thing please help to get the converted date.