Claus on Code

A data dudes random musings about code, bugs, products, life etc.


SQL Convert datetime to Salesforce date format

If anyone, as I, suffers the pain of generating SOQL to salesforce, here’s a little tip 🙂 If you have a datetime field, which you have to use in the SOQL, then convert it like so:

SELECT CONVERT(NVARCHAR,GETDATE(),126)

Then you get it in the format

YYYY-MM-DDTHH:MM:SS.XXX

As salesforce wants it 🙂



Leave a Reply

Your email address will not be published. Required fields are marked *