iam having the date format stored in database as \"20100723\"(YYYYMMDD) and how do i convert it into \"23-JUL-2010\"
strtoupper(date_create("20100723")->format("d-M-Y"))
See the DateTime class, in particular the DateTime::format method. date_create is an alias to the constructor of DateTime.
date_create
DateTime