• Naga Balji B
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
VF page:
<apex:page controller="Time_date"  sidebar="false">
 <apex:form >
  <apex:pageBlock title="Displaying all records of s object">
   <apex:pageBlockSection columns="1">
    <apex:pageBlockTable var="b" value="{!bk}" cellpadding="4" cellspacing="4">
     
     <apex:column headervalue="Name" value="{!b.name}"/>
     <apex:column headervalue="EDITION" value="{!b.Edition__c}"/>
     <apex:column headervalue="Price" value="{!b.price__c}"/>
     <apex:column headervalue="Created Date">
     Date:<apex:outputText value="{!dt}"/>
     Time:<apex:outputText value="{!tm}"/>
     </apex:column>
     <apex:column headervalue="modified Date" value="{!b.LastModifiedDate}"/>
     
    </apex:pageBlockTable>
   </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Apex Class:

public with sharing class Time_date {

    public time tm { get; set; }

    public date dt { get; set; }

    public List<book__c> bk { get; set; }
    public Time_date(){
    bk=[select id,name,edition__c,price__c,Createddate,lastmodifieddate from book__c];
    //dt=DATEVALUE(CreatedDate);+
    //tm=MID(TEXT(CreatedDate - 0.1667), 12, 5);
   datetime Createddate;
    
    //dt=Createddate.date();  //display Error
    //tm=Createddate.Time();


 
    }
}

Output:
createddate field in out I want to display separate date and time

 
VF page:
<apex:page controller="Time_date"  sidebar="false">
 <apex:form >
  <apex:pageBlock title="Displaying all records of s object">
   <apex:pageBlockSection columns="1">
    <apex:pageBlockTable var="b" value="{!bk}" cellpadding="4" cellspacing="4">
     
     <apex:column headervalue="Name" value="{!b.name}"/>
     <apex:column headervalue="EDITION" value="{!b.Edition__c}"/>
     <apex:column headervalue="Price" value="{!b.price__c}"/>
     <apex:column headervalue="Created Date">
     Date:<apex:outputText value="{!dt}"/>
     Time:<apex:outputText value="{!tm}"/>
     </apex:column>
     <apex:column headervalue="modified Date" value="{!b.LastModifiedDate}"/>
     
    </apex:pageBlockTable>
   </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Apex Class:

public with sharing class Time_date {

    public time tm { get; set; }

    public date dt { get; set; }

    public List<book__c> bk { get; set; }
    public Time_date(){
    bk=[select id,name,edition__c,price__c,Createddate,lastmodifieddate from book__c];
    //dt=DATEVALUE(CreatedDate);+
    //tm=MID(TEXT(CreatedDate - 0.1667), 12, 5);
   datetime Createddate;
    
    //dt=Createddate.date();  //display Error
    //tm=Createddate.Time();


 
    }
}

Output:
createddate field in out I want to display separate date and time