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
SFDC Forum 007SFDC Forum 007 

time in hh:mm format

Hi ,

 

 I have the below following code which displays both time and date , but i want to display only the time and not the date,

 

 

if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

Please help me out with my case

 

Thanks in Advance

Noam.dganiNoam.dgani

To get just the time you can do:

 

Dt.time():

SFDC Forum 007SFDC Forum 007

its throwing me an error , can u just tell me the changes that i need to make in my code

 

 

 if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }