title: Calculate average date in PostgreSQL db
body: <p>I have a table in PostgreSQL which has orders purchased at various dates. In order to archive the data we need to merge all the records of the year and merge it into one record with a average purchase date calculated based on the purchase dates.</p>
  
  <p>How do I calculate the average purchase date in PostgreSQL? Or Is there a way to do it in JAVA? </p>