title: Get a field value from a SObject List (Apex)
body: <p>I'm facing with the current problem. 
  I have the following code which is a list of SObject and I want to get "CreatedDate" field.
  I really appreciate ur time and comments, thanks.</p>
  
  <pre><code>public static Object testMeth() {
      List&lt;SObject&gt; leadsAndOpps = new List&lt;SObject&gt;();
      List&lt;Lead&gt; lstLead = [Select Id, Name, CreatedDate FROM Lead];
      List&lt;Opportunity&gt; lstOpp = [Select Id, Name, CreatedDate FROM Opportunity];
  
      //Assign first and second List to Sobject List
      leadsAndOpps.addAll(lstLead);
      leadsAndOpps.addAll(lstOpp);
  
      for(SObject lstExa : leadsAndOpps) {
          String getName = (String)lstExa.get('Name'); = This example works cool
          DateTime getDateVal = (DateTime)lstExa.get(CreatedDate); = Variable doesn't exists
      }
   return leadsAndOpps;
  }
  </code></pre>