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

Format time in users locale
Hi,
I have a rquirement to format a time which is given in HH:MM format (24-hour clock) into the user's locale. I assumed that there would be a fromat() method as the DateTime class does, but it does not exist.
Any ideas how I can do this?
Thanks
I have a rquirement to format a time which is given in HH:MM format (24-hour clock) into the user's locale. I assumed that there would be a fromat() method as the DateTime class does, but it does not exist.
Any ideas how I can do this?
Thanks
Please find the below code:
Another example:
Please do let me know if it helps you.
Regards,
Mahesh
All Answers
Please find the below code:
Another example:
Please do let me know if it helps you.
Regards,
Mahesh
If you are looking for Formula field please check below post
1) https://help.salesforce.com/apex/HTViewHelpDoc?id=formula_examples_dates.htm&language=en_US#getting-hms-from-datetime 1) https://help.salesforce.com/HTViewSolution?id=000181642
How do I convert a Date/Time field for any timezone?
Option 2:-
Please check below post for some example
1) https://developer.salesforce.com/forums/?id=906F00000008wZxIAI
2) http://salesforce.stackexchange.com/questions/8538/convert-time-from-a-different-timezone-other-than-local-to-gmt
Option 3:- How to get Current User Time zone
Exmple 1:- Exmple 2:-
NOTE:- Date and Date/Time values are stored in GMT. When a record is saved, field values are adjusted from the user’s time zone to GMT, and then adjusted back to the viewer’s time zone when displayed in record detail pages and reports. With Date conversions this doesn't pose a problem, since converting a Date/Time to a Date results in the same Date value.
Let us know if this will help
Thanks
Amit Chaudhary