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
bhanu challengebhanu challenge 

writing a trigger as date of brith DOB set default date ...how plz check my code

Error: Compile Error: Illegal assignment from String to Date at line 6 column 1

trigger studentdata on Student_Particluars__c (before insert,before update) {

for(Student_Particluars__c std :Trigger.New){
std.phone__c ='909090099';
std.descripition__c = 'gopal naik';
std.DOB__c = '5/5/2016';

}

}
Best Answer chosen by bhanu challenge
Vasani ParthVasani Parth
Use,
std.DOB__c = date.parse('2016/5/5');
Try giving date in the format yyyy-mm-dd. It should work.

Please mark this as the best answer if this helps