title: How do I change the CreatedDate and lastModifiedDate of a salesforce object using Apex code
body: <p>I need to change the createdDate of a Task in salesforce from the apex code. How do I do this? I surfed through the internet and found that this could be possible with
  1. Enabling the Audit Fields in the permission set.
  2. Can change the createdDate using the dataLoader or API(During data import)
  3. Can modify the date in the Apex test class(Note: We cannot modify the actual data from the test class)</p>
  
  <p>But what I want is I need to change from the Apex code(please done confuse this with test class). Can someone give me a quick solution for this? </p>