You need to sign in to do that
Don't have an account?

time in hh:mm format
Hi ,
I have a date/time field which i am fetching dynamically , i want the time field to be displayed in hh:mm format, below is my code written for time
if(callReppaMap.get(ac.personContactId)!=null){
paDet.crdate=string.valueof(callReppaMap.get(ac.pe
rsonContactId).Date__c.time());
}else{
paDet.crdate='';
}
Please help me out to fetch the time in hh:mm format
Thanks in Advance
Use the format method of date/time to get the text representation you want.
E.g.
The format characters are those from Java simpledateformat, which you can find more information on at:
http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html
Hi,
I have used the same code of urs , still displays with milliseconds, ie: 09:53:00.000Z
below is my code
if(callReppaMap.get(ac.personContactId)!=null){
DateTime dt=System.now();
String dtStr=dt.format('HH:mm');
dtStr=string.valueof(callReppaMap.get(ac.personContactId).Date__c.time());
paDet.crdate=string.valueof(callReppaMap.get(ac.personContactId).Date__c.time());
}else{
paDet.crdate='';
}
Thanks in Advance
I gave you an example of how to convert a date time into a string of that format. You can't just paste this in and expect unrelated code to change its behaviour. You'll need to convert your date time instance to a string using that mechanism.
i have converted my date to string format only... it isint giving
The code you posted above isn't doing that.
nopes didnt do that....
I'm not sure what your last post means. Didn't do what?
If you have changed your code from the last post, perhaps you should consider posting the latest version.
nopes i meant that time part is not being fetched as per my format needed, i tried with the changes said bu you, If you can help me how to do it would be great :)
The code you posted isn't using my code - you've simply copied my example into your class. You need to change your code to format your date/time.
If you have changed the code from the last that you posted, please post the latest version.
Better to follow the links
Time Methods
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_time.htm
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm
Thanks
Prem