I have a requirement to convert the value of a map to to specific date
trigger SPE2updateVintage on SPE_SPETracker__c (after Insert) {
Public Set<id> speTrackerId = new Set<id>();
public list<SPE_SPETracker__c> liSPESPETracker = new List<SPE_SPETracker__c>();
public map<String,Integer> mapDate = new map<string, Integer> {
'january' => 01,
'february' => 02,
'march' => 03,
'April' => 04,
'May' => 05,
'June' => 06,
'July' => 07,
'August' => 08,
'September' => 09,
'October' => 10,
'November' => 11,
'December' => 12
};
public map<id, list<String> > mplanwithTrack =new map<id, list<String> > ();
for( SPE_SPETracker__c Tracker : Trigger.new)
{
speTrackerId.add(Tracker.SPEPlan__c);
}
liSPESPETracker =[select id ,name,DateOfExecution__c,SPEPlan__c from SPE_SPETracker__c where SPEPlan__c in :speTrackerId ];
for(SPE_SPETracker__c speTrackerList :liSPESPETracker){
if(!mplanwithTrack.containskey(speTrackerList.SPEPlan__c)){
mplanwithTrack.put(speTrackerList.SPEPlan__c,new list<String>{});
}
mplanwithTrack.get(speTrackerList.SPEPlan__c).add(speTrackerList.name);
}
system.debug('&&&Test&&&'+mplanwithTrack);
//String strTest = 'December-2015';
//String[] arrTest = mplanwithTrack.get(speTrackerId[0]).split('\\-');
//system.debug('&&&Test123'+arrTest);
in the above code I am getting the name as a string and that contains Month name and year in this format January - 2016 and that I need to convert to a specific date like dd/mm/yyyy date can be populated as a hard code value . can anyone please help me how to trim that string to a date.