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

time format repn in GMT Format

Hi,

 

 I wanted to display the time according to the users time zone,

 

  paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('hh:mm'));

 

 

I am displaying the time but thats not in gmt format, Tell me how to do it.

 

 

Thanks in Advance

Best Answer chosen by Admin (Salesforce Developers) 
APathakAPathak

 

Modify the hh:mm to HH:mm. Capitalized H represents time in 24 hour clock.

 

paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('HH:mm'));

All Answers

venkateshyadav1243venkateshyadav1243

hi use today or system.today method .

 

 

u can also see this link may be it will help full to u.

 

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm

SFDC 007SFDC 007

nopes i am able to display the time, but my problem is i am displaying it in indian standard time, for example 14.00 is displaying as 2.00 for me, so just need to disply time in their country format

APathakAPathak

I guess you want to display the time in 24 hour format :-

 

.format('HH:mm')

 

Please see the link below for complete formatting of date/time :

 

http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html

SFDC 007SFDC 007

yes , correct , say if time is 14.00 it should be displayed as 14.00 not as 2.00 which is displaying for me right nw, need ur help on this to fix it.

 

Kindly help me wat to do

 

  paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('hh:mm'));

 

this is my time declaration part.

 

Thanks

APathakAPathak

 

Modify the hh:mm to HH:mm. Capitalized H represents time in 24 hour clock.

 

paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('HH:mm'));

This was selected as the best answer