+ Start a Discussion
RajanRajan 

Execute method with datetime datatype

Hi friends,
I'm unable to execute my method because unable to pass correct format for datetime datatype. Can any one please let me know the format for execution. In my execute window I have to pass 2 values. One in integer and another is datetime.My code is as below
**********************
@RemoteAction
    global static string SetReminder(Integer dataId, datetime Date_time){
         Recommendation__c recom = [Select id, name, Account__r.Id, Account__r.Name, Recommendation_Contact__r.Name,Recommendation_Contact__r.Contact_YTD_Sales__c, Feedback__c, Account__r.AccountNumber,
                                                 Recommendation_Contact__r.Title, Product_Service__c, Type__c, Opportunity_Score__c, Next_Best_Action__c, Product_Recommendation__c, Primary_SKU__c,  
                                                 Status__c, Recom_External_Id__c from Recommendation__c where Recom_External_Id__c =:dataId];
                system.debug('Recommendation:' +recom);
          if(recom != null){  
              SetReminder__c rem = new SetReminder__c();
              rem.Name = recom.name;
              rem.Recommendation__c = recom.name;
              rem.Recom_External_Id__c = recom.Recom_External_Id__c;
              rem.Date_and_Time__c = Date_time;
              insert rem;
        }
        
         return null;
    }
sunny.sfdcsunny.sfdc
Use this format:
rem.Date_and_Time__c = Datetime.valueOf('2017-01-01 00:00:00');