SOQL Date functions are pretty useful for grouping or filtering data by date fields. With a proper Date function used in the SOQL, the code can potentially limit the query result records a lot. e.g. Query all Tasks that are created today: The above code looks neat enough although the function DAY_ONLY is not that …
Tag Archives: Datetime
Danger: Date value can be assigned to a Datetime variable
Surprisingly in Apex it allows a Date value to be assigned to a Datetime variable without explicit conversion. See an example as follows: Firstly, this would cause a timezone problem. Date d is created as today’s date. The debug log shows that Datetime dt is created based on the timezone of the organization the code …
Continue reading “Danger: Date value can be assigned to a Datetime variable”