Output: -18000000I need to display in mm/dd/yyyy hh:mm:ss based on billing state. There is an option to get time value using google maps api, but it is paid service.Thanks in Advance...@AuraEnabled
public static String gettime(String accId)
{
Account acc =[SELECT id,name,BillingStreet,BillingCity,BillingState,BillingCountry,BillingLatitude,BillingLongitude,Time_Zone__c FROM Account WHERE Id=:accId];
Timezone tz = Timezone.getTimeZone(acc.Time_Zone__c);
DateTime dtpre = DateTime.newInstanceGMT(2000, 11, 1, 0, 0, 0);
String dt= String.valueof(tz.getOffset(dtpre));
return dt;
}
2 respuestas
Hi Narendra,As mentioned in below links: >> http://bdunagan.com/2016/12/28/salesforce-tip-us-timezones/>> https://www.biswajeetsamal.com/blog/formula-field-to-find-time-zone-from-state-field-in-salesforce/One way is to have a formula field that gives timezone based on account billing State.Let me know if it helps you and close your query by marking it as solved so that it can help others in the future. Thanks.