function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

System.TypeException: Invalid date/time

I am using datetime.valueof(date) in a SOQL to convert a date type input to date time and compare it with created date.
 Obj__c optec=[select Name from Obj__c where  createddate>=:datetime.valueof(frmdt_Modt) and createddate<=:datetime.valueof(todt_Modt)  order by name desc nulls last];
I give frmdt_Modt a value of 2008,06,26.
I am getting the following error:
System.TypeException: Invalid date/time: Mon Jun 09 00:00:00 GMT 2008   

I have observed that when I use



it gives result.. 2008-06-09 00:00:00 This date is not getting converted to datetime.....


Any inouts on this

The SOQL datetime format should be like that described in the second post here: