Convert Datetime to string in GMT format?

963    Asked by CarolynBuckland in Salesforce , Asked on Jul 16, 2021

I want to used this string in dynamic SOQL but it gives me a formatted string in local timezone, can anyone help me with how do I get it in GTM How to convert datetime to string in GMT format?

Answered by Carl Paige

You can convert datetime to string according to your specs in GMT.


      String formatedDt = dt.formatGMT('yyyy-MM-dd'T'HH:mm:ss'Z'');


Your Answer

Interviews

Parent Categories