+ Start a Discussion
Arup SarkarArup Sarkar 

Masking Time part in DateTime field in UI

Hi:

 

I have created a DateTime field in my custom object which is shown in the UI, is there any way to mask the time part and just show the date?

 

I need to have the field as DateTime because behind the scene it issues a SOQL and is compared against CreatedDate.

 

 

regards,

Arup

IspitaIspita

Hi,

In case you are not taking input from user and its a standard page just remove it from the pagelayout and use a formula field to just display the date.

If it is custom page you have full control and control the output through coding.

 

Hope this helps....

 

Navatar_DbSupNavatar_DbSup

Hi,

 

You can create a formula field (return type date) and populate this field from your custom datetime field and then during query from SOQL you can use your custom datetime field

 

DATEVALUE( customdatetimefield )

 

If you are not taking the input on standard page from the user then you can remove custom datetime field from UI and use only formula field on UI

 

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Sunay - KVP Bus SolnsSunay - KVP Bus Solns

Hi Arup,

 

This is Sunay representing KVP Business Solutions. I understand you are trying to display a date field on the visual force page without the time being shown. In that case you can refer the below code which will help you in achieving the same:

 

Use this code where you will be referencing the field on the visual force page.

 

<td ><apex:outputText value="{0,date,dd/MM/yyyy }" styleClass="search_main_inner_table_input3" style="width:98.5%"><apex:param value="{!Guest_Profile__c.DOB__c}" /> </apex:outputText></td>

 

Hope this helps:-)

 

 

Hebert OliveiraHebert Oliveira

Thanks Sunay

Your tip was very handy! ;)

Works perfectly.