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
Suraj_BahaleSuraj_Bahale 

How to convert and display Milliseconds to date on visualforce page?

Hello Everyone, I want to display Date in Date formate but it's showing in Milliseconds. 

i have attached vf code, query, and output on VF page.

How to display Date insted of Milliseconds.

Visualforce code:
<td>
{{#if this.CC_Shipment__r.Date_Shipped__c}}
{{this.CC_Shipment__r.Date_Shipped__c}}
{{else}}
   -
{{/if}}
</td>
Query:
SELECT CC_Shipment__r.Date_Shipped__c FROM CC_Shipment_Line_Items__c
Query Result:
Query result on Developer console

Output on VF page:
Output on VF page.

I want to convert this Milliseconds(1569283200000) and show it in Date formate (2019-09-24).

Thank you🙂
Best Answer chosen by Suraj_Bahale
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi suraj,
Try by using format method of date class in the controller before returning values to vf page.
please refer below links which might help you in this
https://salesforce.stackexchange.com/questions/137577/convert-soql-milliseconds-output-to-mm-dd-yyyy-format-in-visualforce-chart
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards

All Answers

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi suraj,
Try by using format method of date class in the controller before returning values to vf page.
please refer below links which might help you in this
https://salesforce.stackexchange.com/questions/137577/convert-soql-milliseconds-output-to-mm-dd-yyyy-format-in-visualforce-chart
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards
This was selected as the best answer
Suraj_BahaleSuraj_Bahale
Thank you for Response @Devi Chandrika,

insted of controller Can we do it on VF page?

Thanks.
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Please refer below link which might help you in this
https://salesforce.stackexchange.com/questions/18958/convert-date-to-milliseconds-and-milliseconds-to-date

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards