How to write SOQL queries with dates
Anw how to remember the format in the future
How to write SOQL queries with dates Date formats and SOQL may be super straightforward. But if you work with multiple languages, it may be hard to remember how you use dates and times in SOQL queries.
TL;DR;
Format: YYYY-MM-DDTHH:MM:SSZ
Example: 2023-05-04T12:02:23Z
There is a quick way to get to the format if you forget it. You can, in your developer instance, open the developer console and write the following piece of “anonymous apex” (check the “Open Logs” box before hitting “Execute”).
Posted by Martin Haagen on Thursday, May 4, 2023