I want to display $row->depositdate in dd-mm-yyyy format.
If the date column in database is null the date displayed is : 01-01-1970
Oh! I know why this happens? Simply you have not included "depositdate" in your SELECT query. Firstly Change SQL query to select all with wild card sign as shown here
$sql = "SELECT * FROM `yourtable`";