

Hi,You can achieve the above scenario by using Batch Apex and Schedule Apex. Please check the below sample code.Batch Class
Schedule classglobal class BatchWishes implements Database.Batchable<Employee__c> {
global Iterable<employee__c> start(Database.BatchableContext bc){
list<employee__c> sq=[select name,empname__c ,Email_Id__c from employee__c where Date_of_Birth__c=today];
return sq;
}
global void execute(Database.BatchableContext bc, List<employee__c> lst)
{
list<Messaging.SingleEmailMessage> mail = new list<Messaging.SingleEmailMessage>();
for(employee__c e: lst)
{
Messaging.SingleEmailMessage maileach = new Messaging.SingleEmailMessage();
list<string> toadd=new list<string>();
toadd.add(e.Email_Id__c );
maileach.settoaddresses(toadd);
maileach.setsubject('birthday wishes');
maileach.setplaintextbody('happy birthday '+e.empname__c);
mail.add(maileach);
}
Messaging.SendEmailResult[] result =Messaging.sendEmail( mail);
}
global void finish(Database.BatchableContext sc)
{
system.debug(sc);
}
}
You can schedule a batch which runs at 12 am every day.Please follow the below steps for Schedule a batch class.Go to Setup--->Develop--->Apex classes--->Schedule ApexHere you can set the time.Please check the below screenshot.global class BirthdayNameOptions implements Schedulable{
global void execute(SchedulableContext dc){
//batch class name
BatchWishes bth=new BatchWishes ();
Database.executeBatch(bth,20);
}
}
Hope this helps you!Best Regards,Jyothsna