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 format in hh:mm representation

Hi,

 

 I want to represent the time in hh:mm format , i am using the following code below,

 

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

rsonContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

but i am getting the date as well as time, please help me with my issue.

 

 

Thanks in Advance

OviOvi

Try something like:

 

System.Now().format('hh:mm')

PremanathPremanath

Hi I have tried this in Developer console , It's giving good follow this code same as well

 

Datetime myDT = Datetime.now();
String myDate = myDT.format('hh:mm');
System.Debug('----------->'+myDate);