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
sona gaikwadsona gaikwad 

datetime.newinstance method now working


 
Test_survey surveyobj =new Test_survey();
String Test_DOBOfFamilyHead ;
surveyobj .Test_DOBOfFamilyHead__c;

Invalid identifier ' datetime.newinstance'. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_'. 
surveyobj.Test_SurveyDate__c= datetime.newinstance(long.valueOf(String.valueOf(reqData.Test_Survey_Date)));

​​​​​​​
Maharajan CMaharajan C
Hi Sona,

If you are trying to convert the date to datetime then refer the below:

Date dt = reqData.Test_Survey_Date;
Datetime dt = datetime.newInstance(dt.year(), dt.month(),dt.day());

Please refer this Doc:  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_datetime.htm

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!

Thanks,
Maharajan.C