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
Ad_InfosysAd_Infosys 

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   
Ad_InfosysAd_Infosys

I have observed that when I use

 

date.newinstance(2008,06,09)

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

 

Any inouts on this
 

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

http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=11392