Before the week ends, here's my next post on handling TimeZone conversion in Apex -
a) Developers might have datetime issue reported before in existing application. This is a good reference for timezone conversion in apex.
http://www.force2b.net/index.php/2010/08/date-time-and-timezone-handling-in-apex/
-------------------------------------------------------------------------------------------------------------------
b) Another way to retrieve SFDC default timezone from User object :
Schema.DescribeFieldResult fieldResult = User.TimeZoneSidKey.getdescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for(Schema.PicklistEntry p : ple){
system.debug('###'+p.getlabel()+'****'+p.getValue()+'\n');
}
Please leave your comment if you agree or have any better approach of handling TimeZone conversion in Apex.
a) Developers might have datetime issue reported before in existing application. This is a good reference for timezone conversion in apex.
http://www.force2b.net/index.php/2010/08/date-time-and-timezone-handling-in-apex/
-------------------------------------------------------------------------------------------------------------------
b) Another way to retrieve SFDC default timezone from User object :
Schema.DescribeFieldResult fieldResult = User.TimeZoneSidKey.getdescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for(Schema.PicklistEntry p : ple){
system.debug('###'+p.getlabel()+'****'+p.getValue()+'\n');
}
Please leave your comment if you agree or have any better approach of handling TimeZone conversion in Apex.
No comments:
Post a Comment